val array= arrayOf("1", "2")
array.map {
println(it)
}
打印
1
2
fun main(args: Array<String>) {
val person = Person("AAA")
val person2 = Person("BBB")
val arrayP = arrayOf(person, person2)
arrayP.map {
println(it.name)
}
}
internal class Person(name: String) {
var name = "小米";
init {
this.name = name
}
}
打印
AAA
BBB
网友评论