This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes 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 "Interface" Watch "Interface" New topic
Author

Interface

shashank dwivedi
Ranch Hand

Joined: Mar 06, 2012
Posts: 63
why variables inside interface are static while methods are not?
sharma ishu
Ranch Hand

Joined: Sep 10, 2012
Posts: 70
because interface methods are abstract and you can't use static+abstract on a method.
Or you can say since static methods can't be overridden you must override a method in interface so you can't use static with interface methods.
Ramesh Pramuditha Rathnayake
Ranch Hand

Joined: Oct 31, 2012
Posts: 178
    
    2

You can't make an object from java interface. Therefore, if the variable are not static, you can never refer them..!

You can't over-ride static methods. That's why we can't write 'static' abstract methods. Methods in an interface are implicitly abstract..


Ramesh-X
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Interface
 
It's not a secret anymore!