能正确运行的: CD
A
public static void main(String args[]) {
byte a = 3;
byte b = 2;
b = a + b;
System.out.println(b);
}B
public static void main(String args[]) {
byte a = 127;
byte b = 126;
b = a + b;
System.out.println(b);
}C
public static void main(String args[]) {
byte a = 3;
byte b = 2;
a+=b;
System.out.println(b);
}D
public static void main(String args[]) {
byte a = 127;
byte b = 127;
a+=b;
System.out.println(b);
}
byte运算只能使用 += -= *= /=
本文深入探讨了Java中byte类型变量的运算规则,特别是在使用加法运算符时的自动类型提升和溢出处理机制。通过四个具体示例,解析了byte运算的特性,包括直接赋值与复合赋值操作符的区别。

1168

被折叠的 条评论
为什么被折叠?



