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



Ask a Question

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. it's amazing intro for me. and i think it will b
View Tutorial          By: amar smarty at 2010-05-25 03:26:39

2. Muy buen ejemplo, aunque como idea general podr&At
View Tutorial          By: Ligator at 2013-07-26 05:57:47

3. Good one. Keep up the good work.
View Tutorial          By: zubair at 2012-02-23 10:18:36

4. nice and simple information...............
View Tutorial          By: sengadu at 2010-07-24 07:43:29

5. I like ASP.net b'cs it is very easy to understand
View Tutorial          By: prachi at 2010-06-02 06:04:50

6. hi!
how can i add variable form object to a

View Tutorial          By: rushi at 2015-07-16 08:18:58

7. Great Work for JAVA Beginners
View Tutorial          By: Sudhir Rajgure at 2009-03-01 02:40:00

8. i apprciate your work,plz keep on working harder a
View Tutorial          By: Raymond B. Benedicto at 2013-01-12 07:08:59

9. u doing good
View Tutorial          By: matsiko at 2009-04-14 08:05:00

10. Enabling IPV6 at Application Level


View Tutorial          By: i want code , can you send me at 2014-12-28 11:43:35