document.write('
D
[解析] 在Java语言中,Integer是int的封装类,Integer的parseInt方法用来将字符串参数解析为有符号的整数。这个方法的原型为:
 public static int parseInt(String s,int radix) throws NumberFormatException
 public static int parseInt(String s) throws NumberFormatException
 其中,参数s用来表示待转换的字符串,radix用来表示字符串s代表的整数的进制。当传入的字符串无法被转换为int类型的时候(例如s=" "),就会抛出异
常。
 valueOf方法的原型如下:
 public static Integer valueOf(int i)
 这个方法返回一个表示指定的int值的Integer实例。
 public static Integer valueOf(String s) throws NumberFormatException
 这个方法返回保存指定的String值的Integer对象。
 而Integer类的intValue方法以int类型返回该Integer的值。
 由此可见,语句a=Integer.parseInt("12");是把字符串“12”转换为int类型,返回值为12。对于语句b=Integer.valueOf("12").intValue(),首先把字
符串“12”转换为Integer实例(实例中整型的值为12),然后调用intValue方法,以int类型返回Integer的值12,因此,a和b的类型都是int型,值都是12。
所以,选项D正确。

 

');