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. if(isset($_POST["check1"]=="1"
View Tutorial          By: krunal at 2012-11-22 10:30:19

2. nice one !!! just keep it .. i have learn a lot..
View Tutorial          By: dondon at 2011-07-27 04:43:40

3. Thank you... Helpful :)
View Tutorial          By: Soopy at 2015-03-31 06:24:57

4. I want de total main prg to send and receive... se
View Tutorial          By: sharu at 2011-09-12 16:49:24

5. You have mentioned that
to use this program

View Tutorial          By: Naasik at 2012-08-05 00:15:57

6. i tried your code but i got an error on this line<
View Tutorial          By: edward at 2011-12-09 11:32:30

7. hello

my problem is how to intrega

View Tutorial          By: mihir patel at 2013-11-28 18:10:04

8. Awesome information
View Tutorial          By: Pavan Somu @ Tech Tips at 2013-01-03 18:45:30

9. really very excellent example....ThanQ...:)
View Tutorial          By: Tulasi at 2010-08-17 00:41:21

10. Hi,first of all thats for this code developer, its
View Tutorial          By: Kathir at 2008-02-08 06:16:51