This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static method in interface

 
avseq anthoy
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any reason for mehtod in the interface can't be marked static?

thx^^

avseq
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic