Open In App

Kotlin Data Types

Last Updated : 04 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The most fundamental data type in Kotlin is the Primitive data type and all others are reference types like array and string. Java needs to use wrappers (java.lang.Integer) for primitive data types to behave like objects but Kotlin already has all data types as objects.

There are different data types in Kotlin:

Integer

These data types contain integer values.

Data Type

Bits

Min Value

Max Value

byte8 bits-128127
short16 bits-3276832767
int32 bits-21474836482147483647
long64 bits-9223372036854775808 9223372036854775807


Let's write a program to represent all the integer data types and their min and max values.

Example:

Kotlin
// Kotlin code 
fun main(args : Array<String>) { 
    var myint = 35
  
    // add suffix L for long integer 
    var mylong = 23L 
    
    println("My integer ${myint}") 
    println("My long integer ${mylong}") 

    var b1: Byte = Byte.MIN_VALUE 
    var</