当前位置:网站首页>Scala sample class case calculate
Scala sample class case calculate
2022-06-25 01:03:00 【Jue Niu thunder plough hot blade】
object Calculate {
case class Calculate(a: Int, b: Int) {
def add(): Int = a + b
def subtract(): Int = a - b
def multiply(): Int = a * b
def divide(): Int = a / b
}
def main(args: Array[String]): Unit = {
val c = Calculate(7, 5)
println(" Add :" + c.add())
println(" Subtraction :" + c.subtract())
println(" Multiplication :" + c.multiply())
println(" division :" + c.divide())
}
}
边栏推荐
- 实现mnist手写数字识别
- 【Redis实现秒杀业务③】超卖问题之乐观锁具体实现
- 2021-11-05
- Go crawler framework -colly actual combat (I)
- Preliminary understanding of qtoolbutton
- Tiktok wallpaper applet v1.0.2 function, new arrival function
- [redis realizes seckill business ③] specific implementation of optimistic lock for oversold problem
- 2022年危险化学品经营单位安全管理人员考试试题及模拟考试
- 2021-09-12
- Leetcode 1248. Statistics of "graceful subarray" (harm, suddenly found that it can only enumerate violently)
猜你喜欢

在企业级开发过程中我发现有位同事用select * from where 条件 for update

Decoupling pages and components using lifecycle

移动安全工具-jar

Applet opening traffic master

打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?

Use coordinatorlayout+appbarlayout+collapsingtoolbarlayout to create a collapsed status bar

Text editor of QT project practice ---------- episode 11

Rich text tables, lists, pictures

Sliding window technology based on byte in transport layer

图书馆管理系统代码源码(php+css+js+mysql) 完整的代码源码
随机推荐
Helm chart仓库操作
Tiktok wallpaper applet v1.0.2 function, new arrival function
Kubernetes 架构核心组件工作原理解析
Thermodynamic diagram display correlation matrix
Xcode preview displays a bug in the content of the list view and its solution
If the order has not been paid for 30 minutes, it will be automatically cancelled. How can I achieve this?
EVM Brief
In the process of enterprise development, I found that a colleague used the select * from where condition for update
2021-11-05
The basic principle and application of iterator and enhanced for
Use of JMeter
Use coordinatorlayout+appbarlayout+collapsingtoolbarlayout to create a collapsed status bar
I brush the question I - copy the linked list with random pointer
大厂高频软件测试面试题和答案都帮你准备好啦,备战金九银十
Can communication experiment between C and C
QT electronic clock
Mobile security tool jarsigner
通过kubernetes可视化界面(rancher)安装kibana
The acceleration of 100 km is only 5.92 seconds, and the willanda high-performance version leads with the strength of high-energy products
不重要的token可以提前停止计算!英伟达提出自适应token的高效视觉Transformer网络A-ViT,提高模型的吞吐量!...