What is Abstract Methods and Class ?
By making a method final we ensure that the method is not redefine in subclass. That is the method can be subclass. Java allows us to do something that is exactly opposite to this. That is we can indicate that a method must always be redefined in a subclass thus making overriding subclass. This is done the modifier keywords abstract in the methods definition such as :
abstract class add
{—————————-
abstract void draw();
—————————-
—————————–
}
When a class contain one or more abstract methods it should also be declare as abstract.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment