The class variables in Segment 151 are public class
variables because they are marked by the keyword public
.
To access a public class variable that is defined in a class different from
that of the method that uses that variable, you must use the class name, a
period, and the variable name, just as you would to access a class method
in a different class. For example, to access the value of the
wScript
variable in the Demonstrate
class, you write the
following expression:
*-- Class name | | *-- Variable name v v ----- -------- Movie.wScript
Java programmers think in terms of selecting the value from a field in the appropriate class. Accordingly, the period is called the field-selection operator.