Elements of Kotlin

The programming language for the first generation of Android app development was Java.

The programming language that will dominate the second generation of Android app development will be Kotlin.

Kotlin is a powerful language, designed to be concise yet expressive, both for application code and for libraries. However, some of that comes at a cost, as Kotlin has a lot more keywords and specialty features than does Java. A lot of that complexity is only needed by intermediate to advanced Kotlin developers, though.

This introductory book to Kotlin focuses on helping existing programmers get up to speed on reading and writing Kotlin code. Particular emphasis is placed on the sorts of syntax and language capabilities that most Kotlin developers will need, with light coverage of the advanced capabilities that allow library developers to create easy-to-use APIs.

Most of the sample code from the book is available in the Klassbook, so you can try running it in your Web browser.

Right now, this book is in an early “beta” state, but it covers most of basics of Kotlin programming.

This book is published in PDF, EPUB, and MOBI/Kindle formats, for use in your favorite digital book reader. Or, read directly in your Web browser on the Warescription site, complete with full-text searching.

Subscribe for $20 »

The Table of Contents

Each bullet shown below represents a chapter. Use the search field in the nav bar to search all of the CommonsWare books to see what they hold!

  • Introducing Kotlin
  • A Few “Hello, World!” Examples
  • Basic Types and Expressions
  • Variables… Whether They Vary or Not
  • Functions
  • Collections and Lambdas
  • If, When, and While
  • Basic Classes
  • Comments and Documentation
  • Properties
  • Visibility and Scope
  • Abstract Classes and Interfaces
  • Data Class
  • The object Keyword
  • Nested Objects and Classes
  • Enums and Sealed Classes
  • Generics
  • Exceptions
  • Annotations
  • Nullability
  • Scope Functions
  • Functional Programming
  • Extension Functions
  • Java Interoperability
  • Annotations on Fields and Generated Accessors
  • Custom Accessors
  • Escaping Keywords
  • Escaped Method Names
  • Property Delegates
  • Constants
  • Abstract Properties
  • Covariance in Generics
  • Contravariance in Generics
  • Reified Type Parameters
  • Anonymous Functions
  • Inline Functions
  • Renamed Imports
  • Operator Overloading
  • Infix Functions
  • Destructuring Declarations
profile for CommonsWare at Stack Overflow, Q&A for professional and enthusiast programmers

What's New

  • New chapter on extension functions
  • Revamped chapter on Java interoperablility
  • New short “Kotlin, WTF?” advanced syntax chapters:
    • Renamed imports
    • Operator overloading
    • Infix functions
    • Destructuring declarations


  • Version 0.2
  • 346 pages
  • Errata

Spread the Word!