Given the definition of class Employee as follows, which options do you think are correct implementations of a class that implements the DAO pattern for class Employee (there are no compilation issues with this code)?.
class Employee { int id; String name; int age; }
a class EmployeeDAO { class DAO { Employee person;/*from w w w .ja va 2 s .com*/ } } b class EmployeeDAO { Employee findEmployee(int id) { /* code */ } Employee seekEmployee(int id) { /* code */ } } c class EmployeeDAO { static Employee findEmployee(int id) { /* code */ } static int create(Employee p) { /* code */ } static int update(Employee p) { /* code */ } static int delete(Employee p) { /* code */ } } d class EmployeeDAO { Employee findEmployee(int id) { /* code */ } int create(Employee p) { /* code */ } int update(Employee p) { /* code */ } int delete(Employee p) { /* code */ } }
c, d
Options (a) and (b) are incorrect.
A class that implements the DAO pattern should define methods for CRUD operations (create, retrieve, update, and delete).
Options (a) and (b) don't define all these methods.
Options (c) and (d) are correct.
Both these options define methods for CRUD operations.
You can implement these methods as static or nonstatic.