It's not a secret anymore!*
The moose likes Beginning Java and the fly likes Doubt regarding Interface methods 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 » Java » Beginning Java
Bookmark "Doubt regarding Interface methods" Watch "Doubt regarding Interface methods" New topic
Author

Doubt regarding Interface methods

santanu biswal
Greenhorn

Joined: Nov 28, 2009
Posts: 2

WHY INTERFACE METHODS ARE NOT STATIC??

I COULD NOT UNDERSTAND IT..

HELP ME..
Ulrika Tingle
Ranch Hand

Joined: Nov 24, 2009
Posts: 92
santanu biswal wrote:
WHY INTERFACE METHODS ARE NOT STATIC??

I COULD NOT UNDERSTAND IT.


What makes you think they should be static?
Muhammad Khojaye
Ranch Hand

Joined: Apr 12, 2009
Posts: 449

see here. Hope it helps.


http://muhammadkhojaye.blogspot.com/
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Santanu, please keep it down.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ulrika Tingle
Ranch Hand

Joined: Nov 24, 2009
Posts: 92
santanu biswal wrote:
WHY INTERFACE METHODS ARE NOT STATIC??

I COULD NOT UNDERSTAND IT..


Interface methods are implicitly abstract and abstract methods cannot be static. This is because static methods always must be given a body in the class where they're defined. And this is because they belong to the class where they're defined. They cannot be given a body in some other class the way abstract non-static methods can.

So interface methods are not static because that would go against the very nature of static methods. If interface methods could be static than they would be the same as non-static methods and it would be meaningless to maintain the difference. So if interface methods could be static then static methods would cease to exist.
santanu biswal
Greenhorn

Joined: Nov 28, 2009
Posts: 2
Thanks a lot Ulrika Tingle ...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt regarding Interface methods