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



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. thnx
View Tutorial          By: Prakash at 2011-07-27 03:05:17

2. I am using my NOKIA 2700 via blutooth connection.
View Tutorial          By: Rahi at 2010-05-11 04:39:33

3. yes it is very good example for Abstract classes a
View Tutorial          By: obulreddy.G at 2010-07-13 22:52:41

4. help me in my final project about arrays
View Tutorial          By: grace at 2013-03-13 09:54:11

5. hi thanks for your tutorial, but I can`t run your
View Tutorial          By: yashar at 2015-05-29 18:57:30

6. Hibernate can be an effective framework if one app
View Tutorial          By: Giao Vu at 2011-08-03 23:40:02

7. tnx, nice code...
View Tutorial          By: Hansoc at 2009-08-18 00:17:58

8. Anyone can send me the java code for send and rece
View Tutorial          By: Alvin at 2008-03-21 01:12:50

9. hi
very tnx for your code

View Tutorial          By: Moji at 2012-08-19 16:06:53

10. Can you tell me what will happen when I use a free
View Tutorial          By: Neo at 2012-04-04 16:21:35