Can anybody explain the differences between these constructors. See this;
public MyClass() {
}
and
public MyClass() {
this();
}
and
public MyClass() {
super();
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Second is not allowed to be declared in java because you are making recursive call to default constructor only. Also by default constructor has always super() method which is inserted by compiler if not specified explicitly.