class Greeting {
companion object {
var name: String = ""
get() = field
set(value) {
field = value
}
var message: String = ""
get() = field
set(value) {
field = value
}
}
}
fun main(args: Array<String>) {
Greeting.name = "h"
Greeting.message = "y"
println(Greeting.name)
println(Greeting.message)
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter