集册 Java实例教程 将Short转换为数字原始数据类型示例

将Short转换为数字原始数据类型示例

欢马劈雪     最近更新时间:2020-01-02 10:19:05

474
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
将Short转换为数字原始数据类型示例


 

public class Main {
/*
时 代      J a v a   公   众 号 - nowjava.com 提 供
*/

 

  public static void main(String[] args) {

    Short sObj = new Short("10");

    byte b = sObj.byteValue();

    System.out.println(b);

   

    short s = sObj.shortValue();

    System.out.println(s);

   

    int i = sObj.intValue();

    System.out.println(i);

   

    float f = sObj.floatValue();

    System.out.println(f);

 

    double d = sObj.doubleValue();

    System.out.print
展开阅读全文