一:代码
public class Test {
public static void main(String[] args) {
//输出byte型的最大值与最小值
System.out.println(Byte.MAX_VALUE);
System.out.println(Byte.MIN_VALUE);
//输出short型的最大值与最小值
System.out.println(Short.MAX_VALUE);
System.out.println(Short.MIN_VALUE);
//输出char型的最大值与最小值
System.out.println(Character.MAX_VALUE);
System.out.println(Character.MIN_VALUE);
//输出int型的最大值与最小值
System.out.println(Integer.MAX_VALUE);
System.out.println(Integer.MIN_VALUE);
//输出long型的最大值与最小值
System.out.println(Long.MAX_VALUE);
System.out.println(Long.MIN_VALUE);
//输出float型的最大值与最小值
System.out.println(Float.MAX_VALUE);
System.out.println(Float.MIN_VALUE);
//输出double型的最大值与最小值
System.out.println(Double.MAX_VALUE);
System.out.println(Double.MIN_VALUE);
//输出float型的正无穷大和负无穷大
System.out.println(Float.POSITIVE_INFINITY);
System.out.println(Float.NEGATIVE_INFINITY);
//输出double型的正无穷大和负无穷大
System.out.println(Double.POSITIVE_INFINITY);
System.out.println(Double.NEGATIVE_INFINITY);
//输出float型0/0
System.out.println(Float.NaN);
//输出double型0/0
System.out.println(Double.NaN);
}
}
二:运行结果