Problem Statement
What are the basic data types in Kotlin and how do they differ from Java primitives?
Explanation
Kotlin has basic types like Int, Long, Short, Byte, Double, Float for numbers, Boolean for true false values, Char for single characters, and String for text, which appear as objects in code but are optimized to primitives by the compiler when possible for performance. Unlike Java which distinguishes primitive types like int from wrapper objects like Integer, Kotlin treats everything as objects providing a consistent API while the compiler handles primitive optimization automatically. All numeric types support standard operations, and you can use underscores in numeric literals for readability like val million equals 1_000_000. Kotlin doesn't have implicit numeric conversions requiring explicit conversion like toInt, toLong, or toDouble for type conversion, preventing subtle bugs from automatic widening. Types can be nullable with question mark suffix, and Kotlin provides better type inference reducing the need to specify types explicitly while maintaining static type safety.
