• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Basics

 
NIKHIL JAIN
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WHY ABSTRACT METHODS CANNOT BE STATIC??
 
sona gold
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because the implementation for every instance of the abstract class would be different
thats the whole idea of abstract classes
 
Jyotsna Clarkin
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abstract methods are designed as a template for subclasses methods. These methods must be implemented by the subclasses. Abstract methods support dynamic binding. Thus the correct implementation will be invoked at run-time.
Static methods are class-specific. Thus a static method is one whose implementation is the SAME for all objects of a particular class. You cannot provide implementation for methods of a different class even if it happens to be a subclass
Static methods are bound at compile time based on the type of the reference, not at run time based on the class of the object.
So static methods will NOT show polymorphic behaviour.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic