변수는 데이터를 담기 위한 메모리 공간을 의미한다.
구분 |
데이터 유형 |
바이트 수 |
데이터 범위 |
예 제 |
정수 |
byte |
1Byte |
(128~127) |
byte a=0; |
short |
2Byte |
(-32768~32767) |
short b = 0; | |
int |
4Byte |
(-2147483648
~2147483647) |
int c = 1; | |
long |
8Byte |
-2^63~2^63-1 |
long d = 0L;
long d = 0I; | |
부동소수 |
float |
4Byte |
(-3.4E38~3.4E38) |
float f = 0.0f;
float f = 0.0F; |
double |
8Byte |
(-1.7E308~1.7E308) |
double g = 0.0;
double g = 1.0d;
double g = 1.0D; | |
문자 |
char |
2Byte |
작은 따옴표로 묶인 문자 |
char h = 'a'; |
논리 |
boolean |
1Byte |
true 또는 false |
boolean b = false; |
자바 키워드(Keyword)
abstract 제한자 (0) | 2020.03.30 |
---|---|
접근 제한자 (0) | 2020.03.29 |
식별자(Identifier) (0) | 2020.03.29 |
키워드(Keyword) (0) | 2020.03.29 |
자바(JAVA)란 무엇인가? (0) | 2020.03.29 |