nerdexam
Oracle

1Z0-805 · Question #50

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

The correct answer is A. Singleton. Java has several design patterns Singleton Pattern being the most commonly used. Java Singleton pattern belongs to the family of design patterns, that govern the instantiation process. Oracle 1Z0-805 Exam This design pattern proposes that at any time there can only be one instanc

Question

Given: public class DataCache { private static final DataCache instance = new DataCache (); public static DataCache getInstance () { return instance; } } Which design pattern best describes the class?

Options

  • ASingleton
  • BDAO
  • CAbstract Factory
  • DComposition

Explanation

Java has several design patterns Singleton Pattern being the most commonly used. Java Singleton pattern belongs to the family of design patterns, that govern the instantiation process. Oracle 1Z0-805 Exam This design pattern proposes that at any time there can only be one instance of a singleton (object) created by the JVM. The class's default constructor is made private, which prevents the direct instantiation of the object by others (Other Classes). A static modifier is applied to the instance method that returns the object as it then makes this method a class level method that can be accessed without creating an object.

Community Discussion

No community discussion yet for this question.

Full 1Z0-805 Practice
Given: public class DataCache { private static final DataCache... | 1Z0-805 Q#50 Answer | NerdExam