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. On my blog (http://www.future-edge.nl/blog/adding-
View Tutorial          By: Robert Willems at 2011-11-29 06:26:21

2. this is the best example of method overriding but
View Tutorial          By: Dipesh at 2009-09-09 12:52:21

3. Daniel Jonsson, you should be thankful to this art
View Tutorial          By: dole at 2011-11-12 06:44:42

4. sir the program is
error: error reading C:

View Tutorial          By: Yashovardhan at 2008-05-05 21:42:27

5. Thank you for sharing your knowledge. =>
View Tutorial          By: Condel Batac at 2013-02-03 23:17:26

6. site is good.explaining the concept with nice pro
View Tutorial          By: AJOY KUMAR MANDAL at 2012-11-22 01:57:26

7. thanks this material is very helpful for me
View Tutorial          By: Anonymous at 2009-05-09 08:04:31

8. good but not v.good. it seems the author is big fa
View Tutorial          By: Muhammad Ishaq Awan at 2014-10-29 07:00:44

9. very simple explanation
View Tutorial          By: shahbaz at 2010-03-19 10:34:32

10. Good work, IT really help me a lot;
View Tutorial          By: TUSHAR at 2010-02-03 01:25:37