Types overview
In Kotlin, everything is an object in the sense that you can call member functions and properties on any variable. Some types, such as numbers, characters, and booleans, have an optimized internal representation as primitive values at runtime, but they appear and behave like regular classes in Kotlin code.
Basic types
This section describes the basic types used in Kotlin:
Category | Basic types | Definition |
|---|---|---|
| Whole numbers | |
| Non-negative whole numbers | |
| Numbers with a fractional part | |
| Logical values: | |
| A single character | |
| A sequence of characters | |
| A fixed-size sequence of values |
To learn about other Kotlin types, such as Nothing, Any, and Unit, look through the Kotlin API reference:
Non-denotable types
Kotlin also has non-denotable types. They are the types that you can't write directly in the Kotlin code. Instead, the compiler uses them internally, for example, for interoperability with other languages. Kotlin creates non-denotable types to represent type information that is more precise than what Kotlin source syntax allows.
Even though you can't declare non-denotable types yourself, you may encounter them in compiler diagnostics, IDE tooltips, or inferred type displays. Learn more about non-denotable types in: