所有的包装类(Integer、Long、Byte、Double、Float、Short)都是抽象类 Number 的子类。
Number y = 2334;
Integer x = 5;
System.out.println(y.byteValue());
System.out.println(y.doubleValue());
System.out.println(y.longValue());
System.out.println(y.floatValue());
System.out.println(y.intValue());
System.out.println(y.shortValue());
输出结果为:
30
2334.0
2334
2334.0
2334
2334