"자바 DataRange 프로젝트"의 두 판 사이의 차이

(새 문서: ;자바 DataRange 프로젝트 ==DataRangeMain.java== <source lang='java'> package datarange; public class DataRangeMain { public static void main(String[] args) { byte byte_min ...)
 
잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(다른 사용자 한 명의 중간 판 4개는 보이지 않습니다)
2번째 줄: 2번째 줄:


==DataRangeMain.java==
==DataRangeMain.java==
<source lang='java'>
<syntaxhighlight lang='java'>
package datarange;
package datarange;


31번째 줄: 31번째 줄:
}
}
}
}
</source>
</syntaxhighlight>


==실행결과==
==실행결과==
<source lang='text'>
<syntaxhighlight lang='text'>
byte : -128 ~ 127
byte : -128 ~ 127
short : -32768 ~ 32767
short : -32768 ~ 32767
42번째 줄: 42번째 줄:
float : 1.4E-45 ~ 3.4028235E38
float : 1.4E-45 ~ 3.4028235E38
double : 4.9E-324 ~ 1.7976931348623157E308
double : 4.9E-324 ~ 1.7976931348623157E308
</source>
</syntaxhighlight>
:→ float, double은  MIN_VALUE가 최소값이 아니라 0에 가장 가까운 값이다.<ref>실제 최소값은 -1 × MAX_VALUE</ref>
:→ float: <math>1.4\times10^{-45}</math> ~ <math>3.4028235\times10^{38}</math>
:→ double: <math>4.9\times10^{-324}</math> ~ <math>1.7976931348623157\times10^{308}</math>


==같이 보기==
==같이 보기==
*[[자바 자료형]]
*[[자바 자료형]]
*[[자바 개발 환경]]
*[[자바 개발 환경]]
*[[래퍼 클래스]]
==주석==
<references/>


[[분류: Java]]
[[분류: Java]]

2020년 11월 2일 (월) 02:49 기준 최신판

자바 DataRange 프로젝트

1 DataRangeMain.java[ | ]

package datarange;

public class DataRangeMain {
	public static void main(String[] args) {
		byte byte_min = Byte.MIN_VALUE;
		byte byte_max = Byte.MAX_VALUE;
		short short_min = Short.MIN_VALUE;
		short short_max = Short.MAX_VALUE;
		int int_min = Integer.MIN_VALUE;
		int int_max = Integer.MAX_VALUE;
		long long_min = Long.MIN_VALUE;
		long long_max = Long.MAX_VALUE;
		char char_min = Character.MIN_VALUE;
		char char_max = Character.MAX_VALUE;
		float float_min = Float.MIN_VALUE;
		float float_max = Float.MAX_VALUE;
		double double_min = Double.MIN_VALUE;
		double double_max = Double.MAX_VALUE;

		System.out.println("byte : " + byte_min + " ~ " + byte_max);
		System.out.println("short : " + short_min + " ~ " + short_max);
		System.out.println("int : " + int_min + " ~ " + int_max);
		System.out.println("long : " + long_min + " ~ " + long_max);
		System.out.println("char : " + (int)char_min + " ~ " + (int)char_max);
		System.out.println("float : " + float_min + " ~ " + float_max);
		System.out.println("double : " + double_min + " ~ " + double_max);
	}
}

2 실행결과[ | ]

byte : -128 ~ 127
short : -32768 ~ 32767
int : -2147483648 ~ 2147483647
long : -9223372036854775808 ~ 9223372036854775807
char : 0 ~ 65535
float : 1.4E-45 ~ 3.4028235E38
double : 4.9E-324 ~ 1.7976931348623157E308
→ float, double은 MIN_VALUE가 최소값이 아니라 0에 가장 가까운 값이다.[1]
→ float: [math]\displaystyle{ 1.4\times10^{-45} }[/math] ~ [math]\displaystyle{ 3.4028235\times10^{38} }[/math]
→ double: [math]\displaystyle{ 4.9\times10^{-324} }[/math] ~ [math]\displaystyle{ 1.7976931348623157\times10^{308} }[/math]

3 같이 보기[ | ]

4 주석[ | ]

  1. 실제 최소값은 -1 × MAX_VALUE
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}