Discuss / Java / byte和short在运算时会自动提升为int进行计算

byte和short在运算时会自动提升为int进行计算

Topic source

byte b = 1+127; 错误: 不兼容的类型: 从int转换到byte可能会有损失 ,应该如此 byte a = (byte)(1+127);


  • 1

Reply