• Post Reply Bookmark Topic Watch Topic
  • New Topic

abstract method  RSS feed

 
samit majumdar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a abstract method have a static qualifier?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try it out and see what the compiler says.
 
John Grath
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No is the answer but the abstract class can have implemented static methods.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It wouldn't make sense now would it? Static methods are not inherited the same way as regular methods are. When you redefine it in a sub class you're not actually overriding it. Instead, you're shadowing it.

As there is no way of implementing the method in a sub class there will never be an implementation.
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simply, No
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!