October 2018
Intermediate to advanced
370 pages
9h 15m
English
Number data types accept whole numbers and do not support fractions. Kotlin provides four different types of number variables—Integer, Long, Byte, and Short. These data types can be declared with and without type annotation. It can also be easily declared with the following syntax:
var myInt : Int =10 // For Integer variablevar myInt = 10var myLong : Long = 11 // For Long Variablevar myShort : Short = 11 // For Short Variablevar myByte : Byte = -100 For byte variable
MAX_VALUE and MIN_VALUE can be used to find the capacity of each variable.
See the following example:
fun main(args: Array<String>) { println("max integer " + Integer.MAX_VALUE) println("min integer " + Integer.MIN_VALUE)}
The following output shows the maximum ...
Read now
Unlock full access