Java OCA OCP Practice Question 8

Question

The following class diagram demonstrates the relationship between Gold and Silver, which extend the Metal class.

Assume the attributes are all declared public.

Which statement about the diagram is not true?

Diagram://from w w w  .ja v  a  2 s .c o  m

                Metal 
                + weight 
                + color 
                  |
  +---------------+----------------+
  |                                |
Gold                             Silver 
+ hue                            + luster 
  • A. The diagram demonstrates platform independence in Java.
  • B. The diagram demonstrates object-oriented design in Java.
  • C. The Gold and Silver classes inherit weight and color attributes from the Metal class.
  • D. Gold does not inherit the luster attribute.


A.

Note

The diagram is an example of object-oriented design in Java.

B a true statement.

Options C and D are true, as they follow from the inheritance model in the diagram.

Option A is the correct answer, since platform independence has nothing to do with the diagram.




PreviousNext

Related