上QQ阅读APP看书,第一时间看更新
Class variables
There are four class variables in the ControlBox class. The first two set the minimum and maximum values for the slider and are final int variables. The second two class variables are poweredOn and sliderValue. The poweredOn variable is of the Boolean type and will be used to store the state of the power. The sliderValue is an int variable and simply holds the current value of the slider:
public class ControlBox {
// Class Variables - Public / Final
public static final int SLIDER_MIN = 0;
public static final int SLIDER_MAX = 100;
// Class Variables - Private
private boolean poweredOn;
private int sliderValue;
The initial part of the ControlBox class is provided.