lc
作者:互联网
class Student(name:String,var age: Int){
def printInfo():Unit = {
println(name + ""+ age + "" + Student.school)
}
}
object Student{
val school:String= "zml"
def main(args: Array[String]): Unit = {
val zml = new Student("zml", 18)
val zxc = new Student("zxc", 16)
zxc.age = 22
zml.printInfo()
zxc.printInfo()
var mn:Int = 60
val pl:Int = 5
var y:Int =mn+pl
}
}
标签:zxc,zml,val,Int,printInfo,Student,lc 来源: https://www.cnblogs.com/zml603/p/16289868.html