What design pattern does the Drivermanager.getconnection () method characterize?
A.
DAO
B.
Factory
C.
Singleton
D.
composition
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.Note 2:
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.