Beyond its support for nullability, Kotlin’s type system has several essential features to improve the reliability of your code and implements many lessons learned from other type systems, including Java’s. These decisions shape the way you work with everything in Kotlin code, from primitive values and basic types to the hierarchy of collections found in the Kotlin standard library. Kotlin introduces features such as read-only collections and refines or doesn’t expose parts of the type system that have turned out to be problematic or unnecessary, such as first-class support for arrays. Let’s take a closer look, starting with the basic building blocks.
This section describes the basic types used in programs, such as Int, Boolean, and Any. Unlike Java, Kotlin doesn’t differentiate primitive types and wrappers. You’ll shortly learn why and how it works under the hood. You’ll see the correspondence between Kotlin types and such Java types as Object and Void, as well.