Study

Accessor & Mutator Methods

  •   0%
  •  0     0     0

  • Given class Counter above, what is the type of getValue() method in the code segment? (accessor or mutator)
    accessor
  • Given class Counter above, what is the type of count() method in the code segment? (accessor or mutator)
    mutator
  • How many accessor methods do you see in the code segment above?
    2
  • Consider the above code segment. What is the return type of the getDay() method?
    int
  • Given class Counter above, how many instances of the Counter class are created in the code segment?
    2
  • True or False: The coinName variable can be accessed only by methods of the Coin class.
    True
  • Name the instance methods that are available in class Counter.
    getValue() and count()
  • The process of hiding object data and providing methods for data access is called ______________________.
    encapsulation
  • You should declare all instance variables as ____________________.
    private
  • What is the return type of getModelName() method?
    String
  • True or False: setVehicleAttributes is an accessor method.
    False
  • How many instance variables are created in the code segment above?
    3
  • Given class Counter above, how many instance variables are created in the code segment?
    1
  • Given class Counter above, how many instance methods are created in the code segment?
    1
  • How many parameters does the getDay() method have?
    0