摘要: 首先上一段代码 1 class Person { 2 var age: Short = 90 3 var name: String = _ 4 5 def this(n: String, a: Int) { 6 this() 7 this.name = n 8 this.age = a}} 9 10 阅读全文
posted @ 2020-08-23 21:25 凯尔哥 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 在scala中,一切皆对象。而对象在调用方法时有以下几种方式: 第一种方式:对象.方法名(参数1,参数2,...) 实例:1.to(10) => Range(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) 第二种方式:对象 方法名(参数1, 参数2,...),即可以省略中间的"."号。 阅读全文
posted @ 2020-08-23 10:10 凯尔哥 阅读(1116) 评论(0) 推荐(0) 编辑