Quiz #3

Friday

With a piece of paper, write down your name and answers to the following questions.

  1. What is the Java keyword that can be used to represent an instance of the class in which it appears and can be used to access class variables and methods?

    1. me
    2. this
    3. that
    4. self
  2. What object collaboration relationship does the following UML diagram demonstrate?

    Class Diagram

    1. Nesting
    2. Aggregation
    3. Concatenation
    4. Class Fielding
  3. Should class designers avoid returning references to mutable private fields because doing so may allow users of the class to adversely affect the internal state of an object?

    Answer: Yes, they should avoid returning references to mutable private fields.

  4. What is the output of the following program?