Demo entry 6783106

Kotlin class example


Submitted by Povilas on Jan 29, 2019 at 14:36
Language: Kotlin. Code size: 371 Bytes.

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}")

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).