Interfaces

Interfaces are used to decouple the code. Kotlin interfaces are very much like Java 8 interfaces. That means they can have both abstract methods as well as method implementation.

You can declare properties in interfaces. A property declared in an interface can either be abstract or it can provide implementations for accessors. Properties declared in interfaces can't have backing fields and therefore accessors declared in interfaces can't reference them.

Get Hands-On Serverless Applications with Kotlin 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.