标签:
1:object的中的代码,会在object对象被调用的时候执行且只会执行一次
object Demo{ println("gaoxing") def name = "nihao" } object Test extends App{ println(3) print(Demo.name) print(Demo.name) print(Demo.name) }
scala的object知识点
原文地址:http://www.cnblogs.com/gaoxing/p/4703436.html