Kotlin Under the hood: the magic of classes. Part 2

Kotlin Under the hood: the magic of classes. Part 1.

Example #1: Multiple constructors

Primary constructor(without keyword)
Additional constructor

Example #2: Init block

Shared init block(Kotlin)
Shared init block(Java)
Custom init block(Kotlin)
Custom init block(Java)

Example #3: Open classes

Example #4: Sealed classes

Sealed class(Kotlin)
Sealed class(decompiled)

Example #5: lateinit

lateinit (Kotlin)
lateinit (decompiled)
initialization check (Kotlin)
doThings(decompiled)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store