Java - Classes and Objects
What will be the output of this code?
class Light {
boolean isOn = false;
void switchOn() {
isOn = true;
}
void printStatus() {
System.out.println(isOn);
}
}
public class Test {
public static void main(String[] args) {
Light l1 = new Light();
Light l2 = new Light();
l1.switchOn();
l2.printStatus();
}
}