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) }