InterviewSolution
| 1. |
What are the various data types available in Kotlin? Explain them. |
||||||||||||||||||||||||
|
Answer» Primitive data types are the most BASIC data types in Kotlin, and all others are reference types like array and string. Kotlin contains all data types as objects. FOLLOWING are the different data types available in Kotlin:- Integer Data Type -
Floating Point Data Type -
BOOLEAN Data Type - True or false is the only bit of information represented by the Boolean data type. In Kotlin, the Boolean type is the same as in Java.
Character Data Type - Small letters (a-z), capital letters (A-Z), numerals (0-9), and other symbols are represented by the character data type.
String Data Type - Strings are represented in Kotlin by the type String. A string value is OFTEN a sequence of characters enclosed in double quotations ("). The space required in this CASE depends on the number of characters in the string. Array Data Type - The Array class in Kotlin is used to represent arrays. It has the get and set functions that, due to operator overloading conventions, can be used as ‘[]’ as well. The space required by the array also depends on the number of elements it posses. |
|||||||||||||||||||||||||