CODEDRAGON ㆍDevelopment/Kotlin
숫자타입(Number Type)
· Int, Double, Float, Long, Short, Byte 타입을 제공합니다.
· Int, Double, Float, Long, Short, Byte 클래스이며 이 타입을 명시하여 선언한 변수는 그자체로 객체(object)입니다.
· 자동형변형(implicit conversions for number)을제공하지않는다.
· 숫자타입에서 8진수를 지원하지 않습니다.
Type |
Bit Width |
Double |
64 |
Float |
32 |
Long |
64 |
Int |
32 |
Short |
16 |
Byte |
8 |
Inheritors
숫자타입의 클래스들은 모두 Number 타입의 서브클래스 입니다.
class Byte : Number, Comparable<Byte> Represents a 8-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type byte. |
|
class Double : Number, Comparable<Double> Represents a double-precision 64-bit IEEE 754 floating point number. On the JVM, non-nullable values of this type are represented as values of the primitive type double. |
|
class Float : Number, Comparable<Float> Represents a single-precision 32-bit IEEE 754 floating point number. On the JVM, non-nullable values of this type are represented as values of the primitive type float. |
|
class Int : Number, Comparable<Int> Represents a 32-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type int. |
|
class Long : Number, Comparable<Long> Represents a 64-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type long. |
|
class Short : Number, Comparable<Short> Represents a 16-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type short. |
언더바(Underscore) 삽입
숫자타입으로 대입되는 데이터에 언더바(Underscore)를 중간에 삽입할 수 있습니다.
val oneMillion: Int = 1_000_000 |
println(oneMillion) // 1000000 |
'Development > Kotlin' 카테고리의 다른 글
Android 환경에서의 Java와 Kotlin 변화추이 (0) | 2018.10.07 |
---|---|
Kotlin Reference (0) | 2018.10.06 |
kotlin version update - A new version x.x.xx-release-IJ20xx.x-x of the Kotlin plugin is available. Install (0) | 2018.10.06 |
Intellij - 실행하기 (0) | 2018.10.05 |
Intellij - install (0) | 2018.10.05 |