© 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 
(1)
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.

Interfaces

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.