0Pricing
Kotlin Academy · Lesson

Platform Types

Nullability from Java.

Kotlin Meets Java

Kotlin runs on the JVM and calls Java code constantly. But Java has no concept of nullable versus non-null types.

So how does Kotlin handle a value coming from Java? Through platform types.

What Is a Platform Type

A platform type is a type Kotlin gets from Java whose nullability is unknown.

Kotlin writes it as String! in error messages. The exclamation means: could be null, could be non-null, Kotlin will not enforce a choice.

All lessons in this course

  1. Nullable and Non-Null Types
  2. Safe Calls and Elvis
  3. The !! Operator
  4. Platform Types
← Back to Kotlin Academy