Java基本数据类型包装类常用的值

2019-06-03 15:19:45 浏览数 (1)

代码语言:javascript复制
public class Program{
   public static void main(String[] args) {

       // Display common numeric types.
       System.out.println(Byte.TYPE);
       System.out.println(Byte.SIZE);
       System.out.println(Byte.MIN_VALUE);
       System.out.println(Byte.MAX_VALUE);

       System.out.println(Short.TYPE);
       System.out.println(Short.SIZE);
       System.out.println(Short.MIN_VALUE);
       System.out.println(Short.MAX_VALUE);

       System.out.println(Character.TYPE);
       System.out.println(Character.SIZE);
       System.out.println((int) Character.MIN_VALUE);
       System.out.println((int) Character.MAX_VALUE);

       System.out.println(Integer.TYPE);
       System.out.println(Integer.SIZE);
       System.out.println(Integer.MIN_VALUE);
       System.out.println(Integer.MAX_VALUE);

       System.out.println(Float.TYPE);
       System.out.println(Float.SIZE);
       System.out.println(Float.MIN_VALUE);
       System.out.println(Float.MAX_VALUE);

       System.out.println(Double.TYPE);
       System.out.println(Double.SIZE);
       System.out.println(Double.MIN_VALUE);
       System.out.println(Double.MAX_VALUE);

       System.out.println(Long.TYPE);
       System.out.println(Long.SIZE);
       System.out.println(Long.MIN_VALUE);
       System.out.println(Long.MAX_VALUE);
  }
}

输出:

代码语言:javascript复制
byte
8
-128
127
short
16
-32768
32767
char
16
0
65535
int
32
-2147483648
2147483647
float
32
1.4E-45
3.4028235E38
double
64
4.9E-324
1.7976931348623157E308
long
64
-9223372036854775808
9223372036854775807

0 人点赞