Basic Types and Expressions
Pretty much every programming language has the concept of data types, things like integers and strings and so forth. Kotlin is no exception. Kotlin’s basic types are modeled somewhat after Java, as Kotlin’s original target environment was the JVM. However, there are some differences that you will encounter in your Kotlin development work.
Basic Types and “Objectness”
From Kotlin’s standpoint, everything is an object. This stands in contrast to some languages, like Java, where basic types are “primitives” but have object counterparts. So, in Java, int
is a primitive and Integer
is the corresponding object type. Kotlin does away with that distinction, so everything is an object, including things like numbers.
Prev Table of Contents Next
This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.