~/ learn/ comp-308/ cards/ Inner classes & the link to the outer object
1 of 6

An inner class that mutates outer state

An inner class that mutates outer state

Answer

public class LightOn extends Event { public LightOn(long t) { super(t); } public void action() { light = true; } }

action() assigns the OUTER GreenhouseControls field `light` directly — the inner class has full access to its enclosing object's private members.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/27f5163f-390e-4c37-893d-a9e195435bba/flashcard utf-8 LF