Scala caseclass 样例类
程序员文章站
2022-06-14 17:02:24
...
object Test {
def main(args: Array[String]): Unit = {
val tiger = Tiger("zhangsan",19)
println(tiger.name)
println(tiger.age)
}
}
case class Tiger(name:String,age:Int)
结果:
zhangsan
19
笔记:
case class Tiger 不用new出来
上一篇: 幻读与间隙锁.锁规则
下一篇: scala基础