完成打印输出Java所有基本数据类型及所占字节数
最佳答案
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();
}
}
其他回答
其它网友回答:
百度一下就是,百度一下都有了,基础而已