[OCPJP] 單例模式
You want to create a singleton class by using the Singleton design pattern. Which two statements enforce the singleton nature of the design? A. Make the class static. B. Make the constructor private...
MagicLen · https://magiclen.org
本站也提供简体中文版。切换到简体中文版
分類
認證考試的考古題與模擬題解析,包含 Linux 認證(LPIC-1、LPIC-2)與 Java 認證(OCAJP、OCPJP),每一題都附上答案與詳細的解說。
共 888 篇文章
You want to create a singleton class by using the Singleton design pattern. Which two statements enforce the singleton nature of the design? A. Make the class static. B. Make the constructor private...
Which statement is true? A. A compilation error occurs in IceCream. B. A compilation error occurs in Cake. C. A compilation error occurs in Shop. D. A compilation error occurs in Bread E. All classes...
Which code fragment creates an instance of Car? A. Car auto = Car("MyCar")::new; B. Car auto = Car::new; Car vehicle = auto::getCar("MyCar"); C. Rideable rider = Car::new; Car vehicle = rider.getCar(...
Which code fragment, when inserted at line n1, sorts the employees list in descending order of fName and then ascending order of lName? A. .sorted(Comparator.comparing(Emp::getfName).reversed().thenC...
What is the result? A. 20.0 30.0 B. 10 20 C. A compilation error occurs. D. A NumberFormatException is thrown at run time.
Which two modifications enable the code to print Open Close? A. Replace line n1 with: class Folder implements AutoCloseable { B. Replace line n1 with: class Folder extends Closeable { C. Replac...
For which three objects must a vendor provide implementations in its JDBC driver?
What is the result? A. Scan.Printer closed. Scanner closed. Unable to scan. B. Scan.Scanner closed. Unable to scan. C. Scan. Unable to scan. D. Scan. Unable to scan. Printer closed.
What is the result? A. User is registered. B. An AgeOutOfLimitException is thrown. C. A UserException is thrown. D. A compilation error occurs in the main method.
Which modification enables the code fragment to compile? A. Replace line n1 with: IntFunction<UnaryOperator> inFu = x -> y -> x * y; B. Replace line n1 with: IntFunction<IntUnaryOperator> inFu = x ->...