Java/Do it
기본 자바형 크기 구하기
yedevlife
2020. 4. 18. 02:40
public static void main(String[] args) {
System.out.printf("byte형의 크기 ==> %d\n",Byte.SIZE);
System.out.printf("short형의 크기 ==> %d\n",Short.SIZE);
System.out.printf("int형의 크기 ==> %d\n",Integer.SIZE);
System.out.printf("long형의 크기 ==> %d\n",Long.SIZE);
System.out.printf("float형의 크기 ==> %d\n",Float.SIZE);
System.out.printf("double형의 크기 ==> %d\n",Double.SIZE);
System.out.printf("char형의 크기 ==> %d\n",Character.SIZE);
}
☆ (타입).SIZE 하면 해당 타입의 크기 출력할 수 있음.
Int 와 Char 는 풀어서 써야하는 것에 주의. 각각 Integer, Character