abstract class Automobile
{
void honk(){};
}
Why is there a semicolon at the end of the method honk?
About Question com.enthuware.ets.scjp.v6.2.690 :
Moderator: admin
-
- Posts: 5
- Joined: Sun Jul 24, 2011 12:01 pm
- Contact:
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.690 :
It is an empty statement. It is not required but it is not wrong either.
If you like our products and services, please help us by posting your review here.
-
- Posts: 5
- Joined: Sun Jul 24, 2011 12:01 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.690 :
Thanks for the reply...but I am not asking regarding the empty parenthesis but the semicolon which actually isnt required at the end. Also JCreator shows the following compiling error.
Automobile.java:3: missing method body, or declare abstract
void honk();
^
1 error
Automobile.java:3: missing method body, or declare abstract
void honk();
^
1 error
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.690 :
Yes, I am also talking about ; Addition semicolons are not required but they are not wrong. Please use regular Java compiler for OCPJP purpose.
The error message that you have quoted is because there is no method body i.e. { }. It is not because of semicolon.
The error message that you have quoted is because there is no method body i.e. { }. It is not because of semicolon.
If you like our products and services, please help us by posting your review here.
-
- Posts: 5
- Joined: Sun Jul 24, 2011 12:01 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.690 :
Thanks admin for the clarification
Who is online
Users browsing this forum: abcackle, Bing [Bot] and 105 guests