Given the following code:
What is the output?
isAvailable initially has the value true, so the first print outputs true. doStuff() returns !isAvailable, which is false at that moment. That result is assigned to the static field and printed, producing true false.
isAvailable
true
doStuff()
!isAvailable
false
true false
Community Discussion