Nice to see you, Scala
来源:互联网 发布:linux下zip 编辑:程序博客网 时间:2024/05/29 13:33
Nice to see you, Scala
mixin-based composition
Classes are extended by subclassing and a flexible mixin-based composition mechanism as a clean replacement for multiple inheritance.
方法和函数有一些区别:
函数是一个val
方法必须用def来定义
方法可以有多个参数,类似这样的
def addThenMultiply(x: Int, y: Int)(multiplier: Int): Int = (x + y) * multiplier println(addThenMultiply(1, 2)(3)) // 9class Greeter(prefix: String, suffix: String) { def greet(name: String): Unit = println(prefix + name + suffix)} 疑问:这里面的Unit是个什么数据类型呢
case class是不可变的按值比较的类
object 可以理解为单例
trait 只包含字段和方法,多个字段可以聚合
trait 可以被继承
被继承的时候可以重载里面的方法,关键字为override
Main函数
object Main{def main(args: Array[String]):Unit = println("Hello, scala")}
阅读全文
0 0
- Nice to see you, Scala
- 数组nice to see you again
- Nice to meet you
- OpenStack Ceilometer 监控项扩展(havana) - Nice to see you once again
- Lesson 5 Nice to meet you
- Lesson 5 Nice to meet you
- Lesson 5 Nice to meet you
- hello,everyone!Nice to meet you!
- Lesson 3 Nice to meet you.
- 【akMOOC】1-1Nice to meet you!
- To see the people you want to see
- codeforces 810 D . Glad to see you!
- See you~
- See you~
- 【See you】
- Lesson Five Nice to meet you. 很高兴见到你.
- Lesson 5 Nice to meet you 很高兴见到你
- [1] Unit 1 Hello! Nice to meet you!
- spring装配Bean
- Elasticsearch(一)安装
- NYOJ 94 cigarettes
- 数组内置方法
- 吴恩达深度学习课后编程题讲解(python)
- Nice to see you, Scala
- AndroidUi--用GridLayout实现计算器界面
- 深入Java Web技术内幕-----1 web的请求过程:HTTP解析,DNS域名解析
- Windows下Python2,Python3共存且正确安装对应的pip,scrapy
- jzoj5385. 【NOIP2017提高A组模拟9.23】Carry
- Codeforces 864C Bus(模拟水题)
- MT 192 Request for Cancellation撤销请求
- 单例模式要点和几种写法
- 本地html文件放置位置,android中加载本地Html文件