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



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. Hi, a have a problem using bsearch. i need return
View Tutorial          By: Daniel at 2009-03-30 04:11:13

2. Hi this is very clear and helpful, I would like to
View Tutorial          By: JoelC at 2012-11-06 16:23:19

3. thnkss buddyy its very helpful for my assignmentss
View Tutorial          By: yamini at 2011-02-25 21:01:23

4. Working !

Nice example, thanks !

View Tutorial          By: Akh at 2015-01-14 14:22:24

5. this is not good example we want better...
View Tutorial          By: sabari nathan.p at 2011-06-15 03:27:18

6. what will be the output of 'X' in following code a
View Tutorial          By: Amit Goyal at 2009-09-25 05:48:45

7. Its informative and helpful. Thanx
View Tutorial          By: Usama at 2012-07-14 22:16:45

8. hi all m getting following error ,
can anyo

View Tutorial          By: raj at 2008-11-04 21:46:12

9. Hi to all,

I worked on this project

View Tutorial          By: Ashish Agrawal at 2013-06-05 08:38:16

10. Thanks! Can u explain how to use PreparedStatement
View Tutorial          By: Shashank Araokar at 2007-05-07 07:41:54