© Ted Hagos 2018
Ted HagosLearn Android Studio 3 with Kotlinhttps://doi.org/10.1007/978-1-4842-3907-0_4

4. Working with Types

Ted Hagos1 
Manila, National Capital Region, Philippines
What we'll cover:
  • Interfaces

  • Classes

  • Data classes

  • Access modifiers

  • Object declarations

Kotlin, like Java, is a class-based, object-oriented language. It uses interfaces and classes to define custom types. The way Kotlin works with types will feel very similar to the way we’ve worked in Java, but there are also some areas where Kotlin will not feel like we’re in familiar ground. In this chapter, we’ll explore those similarities and differences.


The basic form of an interface in Kotlin, like in Java, looks something like the code in Listing 4-1.
interface Fax { ...

Get Learn Android Studio 3 with Kotlin: Efficient Android App Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.