I had a question in my test that I got confused about (code attached below). To put it shortly, I thought that the variables are reassigned and then added back as a value to the expression (making the output "8, 10") but seems like the original value somehow is not changed. What am I missing?
p.s. Sorry if a similar question exists, I couldn't find one (probably its too obvious :P).
class InitTest{
public static void main(String[] args){
int a = 10;
int b = 20;
a += (a = 4);
b = b + (b = 5);
System.out.println(a + ", " + b);
}
}