Given the following code:
What is the outcome?
A static method belongs to the class rather than to a particular object, so it cannot directly access the instance field foo. The statement foo += 10; therefore causes a compile-time error.
foo
foo += 10;
Community Discussion