Created
August 20, 2019 13:10
-
-
Save rail-rate/92fc9e3680f155eecc2d4c1d1f9bdc73 to your computer and use it in GitHub Desktop.
コンストラクタ1
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("山田", 20) //ここのカッコに値をセットすると下のコンストラクタに値が入る | |
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