Comment on Tutorial - Method Overriding in Java By Henry



Comment Added by : Naveen Kumar

Comment Added at : 2011-04-30 18:44:22

Comment on Tutorial : Method Overriding in Java By Henry
/*Overridding & equals:--> Overriding is another useful feature of object-oriented programming technique. It provide the facility to redefine the inherit method of the super class by a subclass. The method overriding is used to invoking the parent class method by a child class. It is possible when a child class extends the parent class then all the attributes and the methods of parent class inherit by child class.*/

class Test10
{
int num,num1;
public Test10(int num,int num1)
{
this.num=num;
this.num1=num1;
}
public boolean equals(object 0)
{
Test10 t=(Test10)0;
if((t.num==this.num)&&(t.num1==this.num1))
{
return true;
}
return false;
}
public static void main(String[]args)
{
Test10 t1=new Test10(10,21);
Test10 t2=new Test10(10,30);
System.out.println(t1.equals(t2));
}
}


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. this site is very useful to the freshers ...

View Tutorial          By: sweth at 2009-09-02 18:53:46

2. when I exported the data to excel there is a value
View Tutorial          By: mizhelle at 2015-10-10 13:17:56

3. Please don't give example from book this example i
View Tutorial          By: aniruddha at 2011-03-23 00:34:32

4. if suppose i am having connection pool max size 30
View Tutorial          By: Shrikant at 2012-07-20 12:09:33

5. Please some one send me the 6th program developed
View Tutorial          By: mounika at 2008-04-25 02:49:56

6. I have a website and i want to make a option to se
View Tutorial          By: rasel at 2011-11-26 15:50:49

7. hey pls tel me, what is the advantage of method ov
View Tutorial          By: divya at 2013-08-27 14:20:22

8. Hallo every one. I am working on my project in j2m
View Tutorial          By: radhe at 2010-12-14 08:08:25

9. The best explanation....Thanq :)
View Tutorial          By: Gautham at 2012-01-29 05:05:48

10. Nice Article.
View Tutorial          By: Swathi Kumar at 2012-04-15 10:44:14