About Question com.enthuware.ets.scjp.v6.2.690 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
jivraj
Posts: 5
Joined: Sun Jul 24, 2011 12:01 pm
Contact:

About Question com.enthuware.ets.scjp.v6.2.690 :

Post by jivraj »

abstract class Automobile
{
void honk(){};
}

Why is there a semicolon at the end of the method honk?

admin
Site Admin
Posts: 8770
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.690 :

Post by admin »

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.

jivraj
Posts: 5
Joined: Sun Jul 24, 2011 12:01 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.690 :

Post by jivraj »

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

admin
Site Admin
Posts: 8770
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.690 :

Post by admin »

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.
If you like our products and services, please help us by posting your review here.

jivraj
Posts: 5
Joined: Sun Jul 24, 2011 12:01 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.690 :

Post by jivraj »

Thanks admin for the clarification :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests