Created
August 20, 2019 13:31
-
-
Save rail-rate/e90e6af9d9876c5e63ba6fa92d190d1e to your computer and use it in GitHub Desktop.
コンストラクタ2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>) { | |
val a = Test(age = 20, name ="山田") //変数から書けば順番が逆でもエラーにならない | |
a.hello() | |
}//main | |
class Test(var name : String = "", var age : Int = 0){ | |
fun hello(){ | |
println("${name}です。${age}です。HELLO!") | |
}//hello | |
}//Test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment