Scala包定义:
嵌套式:
package a1 { class a1Class{ val age = 10 } package a2 { class PackageTest { def main(args: Array[String]): Unit = { println(new a1Class().age) } } }}
串联式:
package com.citi.packageUtil
包对象:
包对象被编译成带有静态方法和字段的JVM类,名为package.class,位于相应的包下。其中有一个静态字段oName
package com.citi.packageUtilpackage object people{ val oName = "ppp"}package people{ class PackageObject { }}