wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt in interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt in interface" Watch "Doubt in interface" New topic
Author

Doubt in interface

Guru dhaasan
Ranch Hand

Joined: Sep 13, 2006
Posts: 126

Hi,

Why the methods inside an interface should not be static. But the variables are public, final and static


Any explanation appreciated
Regards
Guru


Thanks, Shiv
SCJP, OCE - JSP & Servlets Developer
Srinivasan thoyyeti
Ranch Hand

Joined: Feb 15, 2007
Posts: 557
There is no overriding concept for any variables.

For Methods there no static overriding concept.


Thanks & Regards, T.Srinivasan
SCWCD 1.4(89%), SCJP 5.0(75%)
ShivKumar Rajawat
Greenhorn

Joined: Mar 13, 2007
Posts: 17
All interface methods are implicitly public and abstract. That means they are meant to be overridden by some class.
and static methods can not be overridden. that is why we can not declare a static method in an interface.


Regards<br />-Shiv
Guru dhaasan
Ranch Hand

Joined: Sep 13, 2006
Posts: 126

Thanks shiv
Guru dhaasan
Ranch Hand

Joined: Sep 13, 2006
Posts: 126

Thanks Srinivasan


Andy Morris
Ranch Hand

Joined: May 30, 2004
Posts: 78
Originally posted by Guru dhaasan:
But the variables are public, final and static


As you should know variables that are final and static are constants, and being able to define them in interfaces makes it useful so that all implementing classes can use them.
[ March 15, 2007: Message edited by: Andy Morris ]
Guru dhaasan
Ranch Hand

Joined: Sep 13, 2006
Posts: 126

Thanks Andy

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in interface