class Demo1
{
public static void main(String[] args)
{
byte b = 17;
byte x = 21;
byte m =x +b;
System.out.println("x="+m);
}
}
为什么会报错?
而:
class Demo2
{
public static void main(String[] args)
{
int b = 17;
int x = 21;
int m =x +b;
System.out.println("x="+m);
}
}
却没错.
为什么Demo1里面的x和b明明都是byte类型却会报错,Demo2里面的int类型之间进行运算却没错,求大神解答