Kotlin 數據類型
阿新 • • 發佈:2017-09-23
mil var family ont cells pre min blog str
Kotlin 的常見數據類型:
類型 |
範圍 |
byte |
-128~127 |
short |
32767 |
int |
-2147483648~2147483647 |
long |
9223372036854775807 |
float |
小數點6位 |
double |
小數點後16 |
string |
無 |
驗證代碼:
fun main(agrs : Array<String>) { var B:Byte= Byte.MAX_VALUE; println("max:"+B); B= Byte.MIN_VALUE println("min:"+B); var nub:Int=Int.MAX_VALUE; println("Max:"+nub) nub=Int.MIN_VALUE println("Min:"+nub) var nub_short:Short=Short.MAX_VALUE; println("Max:"+nub_short) nub_short=Short.MIN_VALUE println("Min:"+nub_short) varnub_long:Long=Long.MAX_VALUE; println("Max:"+nub_long) nub_long=Long.MIN_VALUE println("Min:"+nub_long) var nub_double:Double=Double.MAX_VALUE println("Max:"+nub_double) nub_double=Double.MIN_VALUE; println("Min:"+nub_double) }
Kotlin 數據類型