1Z0-805 · Question #38
What design pattern does the Drivermanager.getconnection () method characterize?
The correct answer is B. Factory. DriverManager has a factory method getConnection() that returns a Connection object. Note 1:A factory method is a method that creates and returns new objects. The factory pattern (also known as the factory method pattern) is a creational design pattern. A factory is a Java…
Question
What design pattern does the Drivermanager.getconnection () method characterize?
Options
- ADAO
- BFactory
- CSingleton
- Dcomposition
How the community answered
(31 responses)- A6% (2)
- B74% (23)
- C16% (5)
- D3% (1)
Explanation
DriverManager has a factory method getConnection() that returns a Connection object. Note 1:A factory method is a method that creates and returns new objects. The factory pattern (also known as the factory method pattern) is a creational design pattern. A factory is a Java class that is used to encapsulate object creation code. A factory class instantiates and returns a particular type of object based on data passed to the factory. The different types of objects that are returned from a factory typically are subclasses of a common parent class. The method DriverManager.getConnection establishes a database connection. This method requires a database URL, which varies depending on your DBMS. The following are some examples of database URLs: MySQL, Java DB.
Topics
Community Discussion
No community discussion yet for this question.