public class test_20190920 { public static void main(String[] args) { // 4种整数 2种浮点 1种字符 1种布尔 // 类内部成员变量 静态变量可以不用初始化,局部变量必须初始化 BaseType c = new BaseType(); System.out.println(c.y); System.out.println(c.s); System.out.println(c.i); System.out.println(c.l); System.out.println(c.f); System.out.println(c.d); System.out.println(c.c); System.out.println(c.b); // 通过基本数据类型对应的包装器类,获取取值范围 System.out.println(Byte.MIN_VALUE); System.out.println(Byte.MAX_VALUE); System.out.println(Short.MIN_VALUE); System.out.println(Short.MAX_VALUE); System.out.println(Integer.MIN_VALUE); System.out.println(Integer.MAX_VALUE); System.out.println(Long.MIN_VALUE); System.out.println(Long.MAX_VALUE); System.out.println(Float.MIN_VALUE); System.out.println(Float.MAX_VALUE); System.out.println(Double.MIN_VALUE); System.out.println(Double.MAX_VALUE); System.out.println((int) Character.MIN_VALUE); System.out.println((int) Character.MAX_VALUE); } } class BaseType { byte y; short s; int i; long l; float f; double d; char c; boolean b; }