Given:
public class Main { private static final Main f = new Main(); public static Main c() { return f; } public void update(Main a) { } public void delete(Main a) { } }
Which design pattern or principle is implemented?
F is correct.
The singleton pattern is identifiable by the static variable for the single instance and the accessor returning it.
B is incorrect because there is no interface.
The class just happens to have methods update()
and delete()
, which are similar to those found in a DAO.