Consider
Integer number = Integer.valueOf("808.1");
Which is true about the above statement?
A. The value of the variable number will be 808.1
B. The value of the variable number will be 808
C. The value of the variable number will be 0.
D. A NumberFormatException will be throw.
E. It will not compile.
题解
Integer 为整数的 Wrapper 类别,若是想把不是整数的字符串转成 Integer 对象,会抛出 NumberFormatException 例外。
