What is an abstract method?
A method that has no implementation and which is expected to be implemented by a subclass is called an abstract method.
ex: public void display();
What is an abstract class?
A class containing atleast one abstract method is called an abstract class. A method that has no implementation and which is expected to be implemented by a subclass is called an abstract method. An Abstract class cannot be instantiated. It is expected to be extended by a subclass. An abstract class may contain static variables declared. Any class with an abstract method must be declared explicitly as abstract. A class may be declared abstract even if it has no abstract methods. This prevents it from being instantiated.
ex:
public abstract class AAA
{
}
A method that has no implementation and which is expected to be implemented by a subclass is called an abstract method.
ex: public void display();
What is an abstract class?
A class containing atleast one abstract method is called an abstract class. A method that has no implementation and which is expected to be implemented by a subclass is called an abstract method. An Abstract class cannot be instantiated. It is expected to be extended by a subclass. An abstract class may contain static variables declared. Any class with an abstract method must be declared explicitly as abstract. A class may be declared abstract even if it has no abstract methods. This prevents it from being instantiated.
ex:
public abstract class AAA
{
}
No comments:
Post a Comment