April 2019
Intermediate to advanced
360 pages
9h 17m
English
The Starter class includes two class variables, a constructor method, an accessor method, and two methods that toggle the starter on and off. The constructor is used to instantiate copies of the class. The accessor method simply returns the value of the poweredOn variable:
public class Starter { private WidgetProductionSystem mediator; private boolean poweredOn; // Constructor public Starter(WidgetProductionSystem mediator) { this.mediator = mediator; poweredOn = false; mediator.mediateStarter(this); } // accessor public boolean isSystemOn() { return poweredOn; } public void turnOn() { poweredOn = true; mediator.starterPoweredOn(); System.out.println("Mediated Event: Started Powered On"); } public void turnOff() { poweredOn = false ...
Read now
Unlock full access