Java 의 기본 타입 및 크기
Java's Primitive Data Types
boolean
1-bit. May take on the values true and false only.
true and false are defined constants of the language and are not the same as True and False, TRUE and FALSE, zero and nonzero, 1 and 0 or any other numeric value. Booleans may not be cast into any other type of variable nor may any other variable be cast into a boolean.
byte
1 signed byte (two's complement). Covers values from -128 to 127.
short
2 bytes, signed (two's complement), -32,768 to 32,767
int
4 bytes, signed (two's complement). -2,147,483,648 to 2,147,483,647. Like all numeric types ints may be cast into other numeric types (byte, short, long, float, double). When lossy casts are done (e.g. int to byte) the conversion is done modulo the length of the smaller type.
long
8 bytes signed (two's complement). Ranges from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807.
float
4 bytes, IEEE 754. Covers a range from 1.40129846432481707e-45 to 3.40282346638528860e+38 (positive or negative).
Like all numeric types floats may be cast into other numeric types (byte, short, long, int, double). When lossy casts to integer types are done (e.g. float to short) the fractional part is truncated and the conversion is done modulo the length of the smaller type.
double
8 bytes IEEE 754. Covers a range from 4.94065645841246544e-324d to 1.79769313486231570e+308d (positive or negative).
char
2 bytes, unsigned, Unicode, 0 to 65,535
Chars are not the same as bytes, ints, shorts or Strings.
출처 :
구글로 검색한 어느 곳
'Engineering > Java' 카테고리의 다른 글
java version 변경(update-alternatives) (0) | 2015.12.03 |
---|---|
com.fasterxml.jackson.databind.ObjectMapper 와 org.codehaus.jackson.map.ObjectMapper 차이점 비교 (0) | 2015.11.18 |
linux 에 maven(mvn) 설치 (1) | 2014.07.31 |
blowfish 를 이용한 문자열 인코딩/디코딩 예제 (0) | 2013.10.30 |
Spring jdbcTemplate 를 이용해서 프로시저/함수 호출 (0) | 2013.08.29 |