Comment on Tutorial - Method Overriding in Java By Henry



Comment Added by : Naveen Kumar

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

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. Very helpful tutorial for me.
Thank you for

View Tutorial          By: Mohan at 2012-05-28 00:12:56

2. this code is very and help in our project BUT
View Tutorial          By: bhamre sandeep at 2010-02-28 03:02:53

3. the difference is of great important for new comme
View Tutorial          By: ramesh shetty at 2013-03-12 15:27:23

4. In your example http://twitter.com/statuses/updat
View Tutorial          By: thomas wilkinson at 2012-11-02 01:03:45

5. hi
I have to learn java using NetbeansIDE

View Tutorial          By: Ekanki at 2011-08-04 10:30:36

6. thanks , but i want it some thing like fibonici se
View Tutorial          By: Arpit Agrawal at 2015-01-04 18:34:41

7. can any body help to get the code for receiving SM
View Tutorial          By: ash at 2008-05-15 01:07:19

8. thnks a lot...
View Tutorial          By: iti at 2015-06-03 07:05:24

9. This all works fine, but when I read records from
View Tutorial          By: Ayac at 2011-10-31 10:58:21

10. Article from Java Complete Reference
View Tutorial          By: venkatesh at 2013-06-04 01:29:02