Introduction

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

One of the best aspects of Kotlin is how well-designed the entire language is. From the moment the first stable version arrived in 2016 until now, Kotlin has continuously improved, making it easy for developers to create top Android experiences. One neat, sometimes overlooked feature of Kotlin is a companion object. Kotlin companion objects are accessible, intuitive ways to accomplish fairly routine tasks when writing an Android app.

What Are Kotlin Companion Objects?

Kotlin companion objects are objects associated with or “living inside” a class. A class is a collection of methods and data structures, so a companion object is merely a data structure living within a class.

See forum comments
Download course materials from Github
Previous: Quiz: Write Extensions Next: Instruction