Created
August 21, 2019 10:42
-
-
Save rail-rate/feed0bf50d6f37dbf4394a3aa10cc05f to your computer and use it in GitHub Desktop.
コンストラクタ4
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 ="山田") //名前と年齢 | |
val b = Test(name = "山田") //名前だけ | |
val c = Test(age = 20) //年齢だけ | |
a.hello() | |
b.hello() | |
c.hello() | |
}//main | |
class Test(var name : String var age : Int){ | |
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