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



Ask a Question

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 tutorial, but I have a small question he
View Tutorial          By: Mohammad NABIL at 2010-07-20 05:58:19

2. Thanks Friend it was very helpfull.
View Tutorial          By: UMAR FAROOQ at 2015-03-01 07:46:43

3. Many Thanks.
View Tutorial          By: Kallol Samaddar at 2013-07-11 18:26:06

4. i want some brief realtime examples
View Tutorial          By: SURYA.C at 2015-08-20 05:06:18

5. hi
Can you anyone please post me the entir

View Tutorial          By: yasmeen at 2009-05-25 02:42:44

6. sir... i made a program just like that ... but the
View Tutorial          By: David at 2010-07-08 03:34:13

7. The code gives the following exception :-
<

View Tutorial          By: VIKRAM at 2007-03-11 22:56:16

8. thanks a lot ya i got it.................
View Tutorial          By: sruthi at 2013-02-02 08:18:07

9. Good Information... Plz give some more examples wi
View Tutorial          By: Uetian at 2010-04-01 04:26:55

10. Everything is running.... But it doesn't send....<
View Tutorial          By: uu at 2009-04-09 18:10:13