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 static method in interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "static method in interface" Watch "static method in interface" New topic
Author

static method in interface

avseq anthoy
Ranch Hand

Joined: Apr 27, 2004
Posts: 102
Are there any reason for mehtod in the interface can't be marked static?

thx^^

avseq


My Way,My Pace
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
You can get an idea by trying to code it:



The compiler tells us:


So the interface method mm can't have an implementation, it is an abstract method. To give mm an implementation you must override the method in a class implementing the interface. But you cannot override static methods.


An abstract class can have a static method but its implementation must be provided by the abstract class.

[ May 25, 2004: Message edited by: Barry Gaunt ]
[ May 25, 2004: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: static method in interface
 
Similar Threads
nested interface
Can a class be defined in an interface?
Inheritance
Interface doubt
Interface??