I am not sure if i understand this loop
boolean b = false;
while(!b) {
System.out.println(b);
b = !b;
}
it returns a false, loop is executed once
but does while(!b) set b= true ? like !b = !false and b is printed out?
The while (!b) condition does not set b to true.
The b = !b statement does.
That's why your loop executes only once.
Translation in pseudo-code:
not b (that is, while b is false)b (so print false)b to not b, that is, the opposite of b (so assign b to true)b is true, so not b condition fails and loop terminates
b = !bdoes that. It invertsb.