Comment on Tutorial - Method Overriding in Java By Henry
Comment Added by : sam
Comment Added at : 2011-06-24 15:13:34
Comment on Tutorial : Method Overriding in Java By Henry
using a same name ,return type and parameter type for a method in a derived class as that of a method i.e, present in the base class is known as method overridind
class y extends x
void show()//notice void show ()is present in both the base class and the derived class//
public static void main(string n)
y y1=new y();//y1....derived class object//
though it`s possible to invoke the base class method within the derived class object.
When the statement y1.show();is exicuted,the show() of Derived class(i.e,y) is invoked reasulting in the out put 'hello'.
the base class method show() is said to be hidden from the derived class method show(). In order to exicute show()of the base class therre are twomethods
1. By creating an object for th base class.
2. By using super keyword
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Subscribe to Tutorials
8. how to create a do while,the output wil show the m
View Tutorial By: waa at 2009-09-02 19:23:45