In Kotlin, primitive types are basic data types that are not classes. They are optimized for performance and memory usage. There are six primitive types in Kotlin:
1. Boolean
2. Char
3. Byte
4. Short
5. Int
6. Long
7. Float
8. Double
Here are some examples:
1. Boolean: A Boolean value is either true or false.
val isTrue: Boolean = true
val isFalse: Boolean = false
2. Char: A Character represents a single character.
val letter: Char = 'A'
3. Byte: Byte represents an 8-bit signed integer.
val byte: Byte = 16
4. Short: Short represents a 16-bit signed integer.
val short: Short = 2000
5. Int: Int represents a 32-bit signed integer.
val int: Int = 50000
6. Long: Long represents a 64-bit signed integer.
val long: Long = 100000000L
7. Float: Float represents a 32-bit floating point number.
val float: Float = 3.14F
8. Double: Double represents a 64-bit floating point number.
val double: Double = 3.14159