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. better if it is explained with output of the progr
View Tutorial          By: dinesh at 2013-05-05 13:57:21

2. Hi,

I tried this script with noki

View Tutorial          By: sravan at 2009-07-11 11:17:45

3. Easy to understand... thank u....
View Tutorial          By: saranya at 2013-02-11 10:37:07

4. Hi...i know java but little....
give simple

View Tutorial          By: Murshidha at 2012-02-06 09:52:52

5. Hi,

I have tried with your script a

View Tutorial          By: Ivan at 2011-09-08 21:17:36

6. Sir, I need to use MS Access as a database in java
View Tutorial          By: John Moses at 2012-03-31 00:20:38

7. Thanks a lot.
View Tutorial          By: Manna at 2008-07-07 22:18:49

8. hi
View Tutorial          By: raj at 2010-02-12 02:48:09

9. Thanks for the explanation.
It makes sense

View Tutorial          By: Miguel JImenez at 2009-05-10 14:28:46

10. it's very helpful for java beginner. thanks
View Tutorial          By: Pisal at 2012-12-03 05:00:54