导入
别的文件中类,对象,特质
同一个包下面的文件,相互之间不需要import
1.同事导入多个类:import 包。{类1,类2}
import jhart.com.model.Student
import jhart.com.model.Teacher
2.同事导入包下所有类
*/
import jhart.com.model._
//3.导入之后,重命名
import jhart.com.model.{Student => Stu}
object Test {
class Student() {
println("Student")
}
}
def main(args: Array[String]): Unit = {
//不需要import,因为Student和当前测试文件在同一包下面
new Stu()
new Student()
new Teacher()
}