Abstract classes may not contain abstract methods

Java Programming Language Polymorphism in Java (Article) Polymorphism in Java (Program)

1042

Program:


abstract class Parent{
  int a=21;
}
class Child extends Parent{

	public static void main(String args[]){
	 Parent obj = new Child();
	 System.out.println(obj.a);
	}
}

Output:

21
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.