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
EX:-
class x
{
void show()
{
system.out.pln("hey");
}
}
class y extends x
{
void show()//notice void show ()is present in both the base class and the derived class//
{
system.out.pln("hello");
}
}
class test3
{
public static void main(string n[])
{
y y1=new y();//y1....derived class object//
y1.show();
}
}

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


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. hiii frds i want to run this program can i run usi
View Tutorial          By: arun kumar ojha at 2011-07-20 00:59:10

2. Good article..
View Tutorial          By: Sudarshan at 2011-03-28 02:57:53

3. Great tutorial. Thanks guys.
View Tutorial          By: John D at 2009-03-21 11:01:58

4. You just save ma arse, had a SQLite database, and
View Tutorial          By: codeRealm at 2011-11-13 12:58:05

5. I got intersting idea about gauge,thanks...
View Tutorial          By: Marimuthu at 2009-07-20 00:56:27

6. So simple..Very easy to understand
View Tutorial          By: G.Tejasree at 2011-11-05 11:51:38

7. </application>
<uses-permission an

View Tutorial          By: saurabh at 2012-01-17 05:00:21

8. How i can comment in server?Some another message
View Tutorial          By: Youjizz at 2013-04-09 00:30:47

9. very nice example
View Tutorial          By: harshal at 2013-02-06 09:34:10

10. Please provide me a particular flow of validations
View Tutorial          By: Deepali at 2013-05-10 10:38:18