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
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is this a valid Interface declaration?
 
Similar Threads
How To Call Two Different Classes From the Main Program Using the Same API?
When should Servlet utility classes be Servlets and when ordinary Java classes?
Sortable Collection with indexed properties
Failed to marshal exception problem
exception over RMI