Number Data Types
int vs long
float vs double
Overflow (리터럴)
long a = 10000000 * 100000; // int * int -> int
System.out.println(a);
>>> -727379968
long b = 10000000L * 100000; // long * int -> long
System.out.println(b);
>>> 1000000000000
double a = 3 / 2;
System.out.println(a); // 소수점 이하 버림 발생
>>> 1.0
double b = 3 / 2.0
System.out.print(b);
>>> 1.5
double c = 3f / 2;
System.out.println(c);
>>> 1.5Memory 계산
Last updated