Created
April 11, 2019 14:09
-
-
Save vodamiro/6a9520743afba03c0355d66bba73f1a1 to your computer and use it in GitHub Desktop.
S_A_Constructors.kt
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
class InitOrderDemo(name: String) { | |
val firstProperty = "First property: $name".also(::println) | |
init { | |
println("First initializer block that prints ${name}") | |
} | |
val secondProperty = "Second property: ${name.length}".also(::println) | |
init { | |
println("Second initializer block that prints ${name.length}") | |
} | |
} | |
InitOrderDemo("hello") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment