Christophe Beyls
Aug 29, 2017 · 1 min read

Technically you are correct, yes. But writing this is illegal:

object Whatever constructor() {

}

The Kotlin compiler will show an error: “Constructors are not allowed for objects”. Because it can’t be invoked directly, the compiler doesn’t call it “constructor”.

The Kotlin documentation also makes a distinction between the primary constructor and initializer blocks. It’s all just a question of semantics I guess.

)

    Christophe Beyls

    Written by

    Android developer from Belgium, blogging about advanced programming topics.