8种基本数据类型有相应的8种包装类(Wrapper)对应,分别是:Character,Byte,Short,Integer,Long,Float,Double,Boolean. 特点: 1.提供了valueOf(String)用于从字符串转换及toString()转换成字符串 2.通过xxxxValue()方法可以得到所包装的值,如Integer对象的intValue()方法. 示例代码: public class DoubleAndString { public static void main(String[] args) { System.out.println("===change String to double==="); System.out.println("d is " + d); //Returns a new double initialized to the value represented } } |
|
来自: dabinglibrary > 《java》