If you inherit an abstract class, you have to provide implementations to all the abstract methods in it.

Java Programming Language / Polymorphism in Java

914

Program:

<code><font  size=2 face="Courier New"><font color="#0066CC"><b>abstract </b></font><font color="#FF0000"><b>class </b></font><font color="#0066CC"><b>Parent</b></font><b>{
  </b><font color="#0066CC"><b>abstract </b></font><font color="#800000"><b>void </b></font><font color="#0066CC"><b>mother</b></font><b>();
  </b><font color="#0066CC"><b>abstract </b></font><font color="#800000"><b>void </b></font><font color="#0066CC"><b>father</b></font><b>();
}
</b><font color="#FF0000"><b>class </b></font><font color="#0066CC"><b>Child extends Parent</b></font><b>{
	</b><font color="#800000"><b>void </b></font><font color="#0066CC"><b>mother</b></font><b>(){
		</b><font color="#0066CC"><b>System</b></font><b>.</b><font color="#0066CC"><b>out</b></font><b>.</b><font color="#0066CC"><b>println</b></font><b>(&quot;I am Your Mother&quot;);
		}

	</b><font color="#800000"><b>void </b></font><font color="#0066CC"><b>father</b></font><b>(){
				</b><font color="#0066CC"><b>System</b></font><b>.</b><font color="#0066CC"><b>out</b></font><b>.</b><font color="#0066CC"><b>println</b></font><b>(&quot;I am Your father&quot;);
		}
	</b><font color="#FF0000"><b>public </b></font><font color="#800000"><b>static void </b></font><font color="#0066CC"><b>main</b></font><b>(</b><font color="#0066CC"><b>String args</b></font><b>[]){
	 </b><font color="#0066CC"><b>Parent obj1 </b></font><b>= </b><font color="#FF0000"><b>new </b></font><font color="#0066CC"><b>Child</b></font><b>();
	 </b><font color="#0066CC"><b>obj1</b></font><b>.</b><font color="#0066CC"><b>mother</b></font><b>();

	 </b><font color="#0066CC"><b>Parent obj2 </b></font><b>= </b><font color="#FF0000"><b>new </b></font><font color="#0066CC"><b>Child</b></font><b>();
	 </b><font color="#0066CC"><b>obj1</b></font><b>.</b><font color="#0066CC"><b>father</b></font><b>();
	}
}
</b></font>
</code>

Output:

I am Your Mother
I am Your father
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.