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. import java.io.File;
import java.util.Scann

View Tutorial          By: sa at 2012-08-02 07:09:30

2. thanks a lot dude,my lecturer took 2 weeks to expl
View Tutorial          By: praveen malinga at 2010-02-25 07:53:01

3. I used the script above, and it seems to work exce
View Tutorial          By: Michael at 2012-05-15 20:50:49

4. This is really helpful, i'm planning to also add a
View Tutorial          By: JhunZhen at 2011-07-09 21:42:32

5. could you please send me a complete appointment re
View Tutorial          By: Jaylon aron at 2010-02-21 02:22:57

6. Thanks a lot .. Great work!!
View Tutorial          By: MonamAlwerfally at 2013-03-26 14:41:29

7. the default construrctor does not give the defalut
View Tutorial          By: muhammad abdullah at 2011-04-11 13:16:20

8. how can we split 12+12 into three tokens like 12,+
View Tutorial          By: arjun at 2012-11-26 11:07:24

9. this is genius.
you are a master of recursi

View Tutorial          By: Chandler at 2010-03-26 09:56:08

10. The synchronization schedule function has been red
View Tutorial          By: Kim at 2014-11-12 10:52:13