Introduction to OOP | Chapter 4: Classes and Methods: | next | previous | audio | real | text |
class PlayingCard { // operations on a playing card public void setFaceUp (boolean up) { faceUp = up; } ... // private data values private boolean faceUp; }Mutators are less common than accessors, but reasons for using are similar.