Java OCA OCP Practice Question 402

Question

Given:

public class Dao {
  Collection<String> findAll() { return null;}
  void create(String a) {}
  void delete(String a) {}
  void update(String a){}
}

And the following statements:

  • I - This is a good use of the DAO pattern
  • II - The DAO needs an interface
  • III - The DAO is missing a method
  • IV - The DAO must use a type other than String

Which of these statements are true?

  • A. Statement I only
  • B. Statement II only
  • C. Statement III only
  • D. Statement IV only
  • E. Statements II and III
  • F. Statements III and IV


B is correct.

Note

The Data Access Object pattern uses an interface so callers aren't dependent on a specific implementation class.




PreviousNext

Related