Basic Class Syntax
Basic syntax of classes in Kotlin, treating the constructor as a function, and empty class bodies
— — — — — — — — — — — — — — —
THE CURRENT VERSION OF THIS ARTICLE IS PUBLISHED HERE.
— — — — — — — — — — — — — — —
Tags: #FYI
This article is part of the Kotlin Primer, an opinionated guide to the Kotlin language, which is indented to help facilitate Kotlin adoption inside Java-centric organizations. It was originally written as an organizational learning resource for Etnetera a.s. and I would like to express my sincere gratitude for their support.
It is recommended to read the Introduction before moving on. Check out the Table of Contents for all articles.
Classes in Kotlin reflect their counterparts in Java to a certain degree, but are designed with brevity in mind, and the way they are written differs in certain aspects. On top of that, Kotlin adds a couple of features that are not available in Java, which makes classes in Kotlin more powerful than their Java counterparts.
But we’ll get to that. For now, let’s start with the basics.
Go back to Foreword, jump to the Table of Contents, or continue to Constructors.