File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Is this a valid Interface declaration? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Is this a valid Interface declaration?" Watch "Is this a valid Interface declaration?" New topic
Author

Is this a valid Interface declaration?

Jasper Vader
Ranch Hand

Joined: Jan 10, 2003
Posts: 284
interface Worker {
void perform_work();
}
... i found the above code in a mock exam... i thought that all methods in an interface need to be abstract?


giddee up
Sridhar Srikanthan
Ranch Hand

Joined: Jan 08, 2003
Posts: 366
Jasper,
all the methods in an interface are implicitly public and abstract. It doesnt matter even if you explicitly state them
Similarly, all variables in interfaces are implicitly public, static and final.
You might have got confused with abstract classes in which the declaration of abstract methods is explicitly done with the abstract keyword
Hope this Helps
Sri
Jasper Vader
Ranch Hand

Joined: Jan 10, 2003
Posts: 284
cheers Sri, thanks for the clarification!
 
jQuery in Action, 2nd edition
 
subject: Is this a valid Interface declaration?