Static initialisation block in Kotlin

Posted by Andre Scott | Updated on

Static initialisation block in Kotlin. From some point of view, companion objects in Kotlin are equivalent to static parts of Java classes. Particularly, they are initialized before class’ first usage, and this lets you use their init blocks as a replacement for Java static initializers:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers