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 good explanation but i need to know how the c
View Tutorial          By: surender at 2011-11-17 11:15:22

2. Updated example to better show Thread T2 showing t
View Tutorial          By: Sanjiv at 2013-05-25 20:26:31

3. I do, the necessaries changes to receive messages
View Tutorial          By: wodie at 2011-05-05 20:39:06

4. Very good tutorial!
View Tutorial          By: Herve at 2011-04-04 08:06:21

5. Hello,
Thank you very much for this sample

View Tutorial          By: Alex at 2010-08-12 07:30:32

6. very usefull article............ thanks to the aut
View Tutorial          By: runa at 2010-10-16 08:43:38

7. Help Me

I just run the ListPorts.ja

View Tutorial          By: srinivas at 2009-04-06 03:14:57

8. program is very long
View Tutorial          By: ajit kumar at 2012-04-21 03:57:13

9. i need a source to send and receive SMS through th
View Tutorial          By: morteza at 2010-03-03 01:53:09

10. I want get data from Mysql into Spinner by using P
View Tutorial          By: Pravin at 2013-01-05 13:36:11