This is my code:
class Example{
public static void main(String args[]){
byte b=10;
//b=b+1; //Illegal
b+=1; //Legal
System.out.println(b);
}
}
I want to know why I'm getting a compilation error if I use b=b+1
, but on the other hand b+=1
compiles properly while they seem to do the same thing.