Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt regarding Interface methods

 
santanu biswal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

WHY INTERFACE METHODS ARE NOT STATIC??

I COULD NOT UNDERSTAND IT..

HELP ME..
 
Ulrika Tingle
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 449
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
see here. Hope it helps.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Santanu, please keep it down.
 
Ulrika Tingle
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Ulrika Tingle ...
 
Those are the largest trousers in the world! Especially when next to this ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!