Is there any difference in between the two method definitions below? Eclipse does not complain for any of them.
private void method1() {
}
and
private void method2() {
};
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.
The semicolon is not part of the method so there is no difference between the method definitions.
The semicolon is just part of the class body.
This is equivalent.
You can put initializer statements in the class body. They are executed when an instance is created. A single semicolon constitutes an empty statement so it is not very useful. Other initializers are more useful: