Comment on Tutorial - Method Overriding in Java By Henry



Comment Added by : Naveen Kumar

Comment Added at : 2011-04-30 18:44:22

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. To RUN this code, follow below steps


View Tutorial          By: Ajay at 2010-09-04 03:01:24

2. Where is the methods related
View Tutorial          By: Osvaldo F. L. Mendes at 2008-03-17 15:40:48

3. this site is so good...... How can we create a mp4
View Tutorial          By: vikram raj at 2011-01-05 01:03:07

4. if the "extend" word is not present does
View Tutorial          By: detteskii at 2011-06-27 09:12:23

5. Thank you
View Tutorial          By: vbulletincoder at 2011-09-13 13:16:40

6. thanks a lot it was really helpful...........for d
View Tutorial          By: Joshi Rocky at 2010-01-29 14:13:40

7. excellent code.....
View Tutorial          By: Anonymous at 2009-05-07 03:09:01

8. There something at Example #2! because when i try
View Tutorial          By: Paul at 2011-08-01 14:38:14

9. while run program i got this error
The serv

View Tutorial          By: jai at 2009-09-04 04:38:39

10. what ll be result for s1==s2 and s1.equals(s2) for
View Tutorial          By: vijay at 2011-08-21 15:09:41