Abstract classes may contain abstract methods, To use an abstract class, you have to inherit it from another class, provide implementations to the abstract methods in it.

Java Programming Language / Polymorphism in Java

1264

Program:


abstract class Parent{
  abstract void age();
}
class Child extends Parent{
	void age(){
		System.out.println("age 22");
		}

	public static void main(String args[]){
	 Parent obj = new Child();
	 obj.age();
	}
}

  

Output:

it is b method
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.