class lianxi
{
public static void main(String args[])
{
int a,c;
a=128;
byte b;
b=(byte)a;
System.out.print(b);
}
}
{
public static void main(String args[])
{
int a,c;
a=128;
byte b;
b=(byte)a;
System.out.print(b);
}
}
a=128,所以在内存中存储为(0000000010000000) b=(byte)a;赋值后,b得到a的低字节(10000000)
别忘记是补码形式的,b的值是-128
不足为怪了!