Why Default constructor need to declare in POJO file which has Parameterized Constructor while instantiating Object?
问题 Suppose I have one POJO class User with a constuctor public User(int id, String name){...} . But when I instantiate the User object like User u=new User() with no parameter Eclipse gives error like The constructor User() is undefined . But it works fine when I have no parameterized Constructor. Can someone please explain why It requires to define default constructor? 回答1: The default (no-parameter) constructor is ONLY provided if you have provided no others. If you define even a single