sample12_6.java
来自「Java SE 6.0前12-16章示的示例代码,简单易学」· Java 代码 · 共 18 行
JAVA
18 行
package wyf.jc;
public class Sample12_6
{
public static void main(String[] args)
{
//将封装的int值转换为其他数值类型
Integer integer=new Integer("52");
byte b=integer.byteValue();
double d=integer.doubleValue();
System.out.println("将字符串“52”转换为byte值以及double值,其值为:"+b+"、"+d+"。");
//将封装的float值转换为其他数值类型
Float floatF=new Float("25.5");
float f=floatF.floatValue();
d=floatF.doubleValue();
System.out.println("将字符串“52”转换为float值以及double值,其值为:"+f+"、"+d+"。");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?