无
不同整型数据类型在内存中占多大(字节),具体格式详见输出样例,输出样例中的?为不同整型数据类型在内存中占的字节数。输出样例如下:
The size of short is ? bytes.
The size of int is ? bytes.
The size of long is ? bytes.
The size of long long is ? bytes.
Java中没有long long
/**
*
* @Title 有容乃大
* @Description 确定不同整型数据类型在内存中占多大(字节),输出不同整型数据类型在内存中占多大(字节)。
*
* @author weijunfu<ijunfu @ qq.com>
* @date 2022/03/17 23:50
* @version 1.0.0
*
*/
public class Main {
public static void main(String[] args) {
System.out.printf("The size of short is %d bytes.\n", Short.BYTES);
System.out.printf("The size of int is %d bytes.\n", Integer.BYTES);
System.out.printf("The size of long is %d bytes.\n", Long.BYTES);
System.out.printf("The size of long long is %d bytes.\n", Long.BYTES);
}
}
public class Main{
public static void main(String[] args) {
System.out.println("The size of short is "+Short.BYTES+" bytes.");
System.out.println("The size of int is "+Integer.BYTES+" bytes.");
System.out.println("The size of long is "+Long.BYTES+" bytes.");
System.out.println("The size of long long is "+ Long.BYTES+" bytes.");
}
} java哪有longlong。。
个人觉得java答案:
public static void main(String[] args){
System.out.println("The size of byte is "+Byte.SIZE+" bytes.");
System.out.println("The size of short is "+Short.SIZE+" bytes.");
System.out.println("The size of int is "+Integer.SIZE+" bytes.");
System.out.println("The size of long is "+Long.SIZE+" bytes.");
}要通过的答案:
public class Main{
public static void main(String[] args){
System.out.println("The size of short is 2 bytes.");
System.out.println("The size of int is 4 bytes.");
System.out.println("The size of long is 8 bytes.");
System.out.println("The size of long long is 8 bytes.");
}
}