nerdexam
Oracle

1Z0-805 · Question #21

1Z0-805 Question #21: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-805 to reveal the answer and full explanation for question #21. The question stem and answer options stay visible for context.

Question

Given: public class TemperatureSensor { public TemperatureSensor () { } public double getCurrTemp () { // . . . method to retrieve temperature from a sensor Return temp; } } Which three changes should you make to apply the singleton design pattern to this class?

Options

  • AMake the class abstract.
  • BAdd a method to return a singleton class type.
  • CChange the access of the constructor to private.
  • DAdd a public constructor that takes a single argument.
  • EChange the class to implement the singleton interface.
  • FAdd a private static final variable that is initialized to new TemperatureSensor{};
  • GAdd a public static method that returns the class variable of type

Unlock 1Z0-805 to see the answer

You've previewed enough free 1Z0-805 questions. Unlock 1Z0-805 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 1Z0-805 Practice