nerdexam
Oracle

1Z0-805 · Question #43

Given the fragment: public class CustomerApplication { Oracle 1Z0-805 Exam public static void main (String [] args) { CustomerDAO custDao = new CustomerDAOMemoryImp1 (); // . . . other methods } }…

The correct answer is C. CustomerDAO custDao = CustomerDAO.getInstance(); E. CustomerDAO custDao = CustomerDAOFactory.getInstance(). Note: Data Access Layer has proven good in separate business logic layer and persistent layer. The DAO design pattern completely hides the data access implementation from its clients. The interfaces given to client does not changes when the underlying data source mechanism…

Building Database Applications with JDBC

Question

Given the fragment:

public class CustomerApplication { Oracle 1Z0-805 Exam public static void main (String [] args) { CustomerDAO custDao = new CustomerDAOMemoryImp1 (); // . . . other methods } } Which two valid alternatives to line 3 would decouple this application from a specific implementation of customerDAO?

Options

  • ACustomerDAO custDao = new customerDAO();
  • BCustomerDAO custDao = (CustomerDAO) new object();
  • CCustomerDAO custDao = CustomerDAO.getInstance();
  • DCustomerDAO custDao = (CustomerDAO) new CustomerDAOmemoryImp1();
  • ECustomerDAO custDao = CustomerDAOFactory.getInstance();

How the community answered

(52 responses)
  • A
    2% (1)
  • B
    8% (4)
  • C
    79% (41)
  • D
    12% (6)

Explanation

Note: Data Access Layer has proven good in separate business logic layer and persistent layer. The DAO design pattern completely hides the data access implementation from its clients. The interfaces given to client does not changes when the underlying data source mechanism changes. this is the capability which allows the DAO to adopt different access scheme without affecting to business logic or its clients. generally it acts as a adapter between its components and database. The DAO design pattern consists of some factory classes, DAO interfaces and some DAO classes to implement those interfaces.

Topics

#DAO pattern#Factory pattern#decoupling#getInstance

Community Discussion

No community discussion yet for this question.

Full 1Z0-805 Practice