Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
コンストラクタ6
fun main(args: Array<String>) {
val a = Test(20)
}//main
class Test(var name : String, var age : Int){
init{
println("イニシャライザブロック内です。")
println("${name}です。${age}歳です。")
}//init
constructor(age: Int) : this("名無し", age) //この行はセカンダリコンストラクタ
}//Test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.