• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about abstract and static

 
Santhi Bharath
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why we cant use abstract and static keywords to a method at a time
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Santhi,

welcome to the JavaRanch

An abstract method can't be static because you can call any static method (even without having an object instance of the corresponding class). But you aren't allowed to call abstract methods because they don't have an implementation. Abstract methods are only method prototypes - a skeleton for methods.

For this reason it doesn't make sense to have a method which is both - static and abstract!

Marco
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic