完成打印输出Java所有基本数据类型及所占字节数

原问题:完成打印输出Java所有基本数据类型及所占字节数
分类:编程开发 > 最后更新时间:【2016-12-12 18:53:42】

最佳答案

public class Calcsizof {

/**

* @param args

*/

private static void calSize() {

System.out.println("Integer: " + Integer.SIZE/8); // 4

System.out.println("Short: " + Short.SIZE/8); // 2

System.out.println("Long: " + Long.SIZE/8); // 8

System.out.println("Byte: " + Byte.SIZE/8); // 1

System.out.println("Character: " + Character.SIZE/8); // 2

System.out.println("Float: " + Float.SIZE/8); // 4

System.out.println("Double: " + Double.SIZE/8); // 8

System.out.println("Boolean: " + Boolean.toString(false));

}

public static void main(String[] args) {

// TODO Auto-generated method stub

Calcsizof calcsizof= new Calcsizof();

Calcsizof.calSize();

}

}

最佳答案由网友  皖东少主  提供
公告: 为响应国家净网行动,部分内容已经删除,感谢网友理解。
11

分享到:

其他回答

其它网友回答:
百度一下就是,百度一下都有了,基础而已

    推荐