隐含转换:(byte,short,char)--int--long--float--double,为什么long是32位,float是64位,怎么转换啊

2024-11-05 05:42:15
推荐回答(1个)
回答1:

释了。

public class Test {

public static int ARRAY_MAX_VALUE = 128;
public static void main(String[] args) {

byte b_Byte = (byte)ARRAY_MAX_VALUE;
short s_Short = b_Byte;
char c_Char = (char)b_Byte;
b_Byte = (byte)0x1234;
int i_Int =(int) s_Short;
s_Short = (short)1.25F;
long l_Long = i_Int;
i_Int = (int)12345L;
float f_Float = (float)l_Long;
double d_Double = 0.5E-4;
i_Int = (int)d_Double;
s_Short = (short)i_Int;
i_Int = (int)l_Long;
Boolean bool_Boolean=true;
//i_Int = (int)bool_Boolean; 不可转换
byte[] b_Array = new byte[b_Byte];
char[] c_Array = new char[b_Byte];
// b_Array = (byte)c_Array; 一个是数组类型,一个是值 不能赋值

}

}