Conclusion

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

You’re nearly there! Now, you can create classes right and left, with a side-serving of init blocks and two secondary constructors for dessert. In this lesson, you learned:

  • A primary constructor is defined in the class’s header and always executes first.
  • A secondary constructor always goes last in the initialization. The initializer blocks kick in before it. There can be many secondary constructors.
  • Initializer blocks are literally blocks of code that are executed during initialization.
  • Object is an ambiguous term usually used for describing instances of a class, but in Kotlin, it’s also the special class type that implements the Singleton pattern natively.
See forum comments
Download course materials from Github
Previous: Demo Next: Quiz: Construct Class Instances