💡 · Foreword

1 min read · Updated on by

The fundamentals of classes, to which the following chapters pertain, are a topic with only a couple of larger differences between Java and Kotlin. Most of the differences are syntactical, allowing for terser code to be written. Unfortunately, even though the changes are small, we still need to go through the whole subject to cover them all. Since classes are a very broad subject indeed, this in turn means that there will be a lot of text to work through.

My expectation is that 99% of what you read will be completely intuitive, and will only require a small adjustment in how you write things. To prevent bogging you down with pointless coding exercises, they will only be included to emphasize fundamental differences between Java and Kotlin. Otherwise, only the theory is discussed.

Here, more than anywhere else, I recommend sort of skimming through the contents to get a general understanding of where the differences are, and come back to the material as a reference once you start writing actual code. In most cases, learning by doing is preferable to spending hours studying material you already know. Two exceptions are the lessons on Properties and Generics, which are worth dedicating some focus to.

The instructions above do not apply to the part of the Primer that follows this one, which is called “Classes — What is different” and starts with the chapter on Data Classes. From that point on, almost everything will be new.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

The Kotlin Primer