Chapter 11Java Class Design

THE OCP EXAM TOPICS COVERED IN THIS PRACTICE TEST INCLUDE THE FOLLOWING:

  • Java Class Design
    • Implement encapsulation
    • Implement inheritance including visibility modifiers and composition
    • Implement polymorphism
    • Override hashCode, equals, and toString methods from Object class
    • Create and use singleton classes and immutable classes
    • Develop code that uses static keyword on initialize blocks, variables, methods, and classes
  1. Which answer choice can replace line 6 so the code continues to produce the same output?

    3:   List<String> rug = new ArrayList<>();
    4:   rug.add("circle");
    5:   rug.add("square");
    6: System.out.println(rug); ...

Get OCA / OCP Java SE 8 Programmer Practice Tests now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.