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. I need a sample jsp(using Struts html tags) in thr
View Tutorial          By: Anil Kumar at 2008-10-23 04:14:51

2. i find out this example quite heplful thnx adimn..
View Tutorial          By: ayaz pathan ( MUET) at 2010-02-21 10:40:18

3. Abstract class example is good, What is the differ
View Tutorial          By: megakumar at 2011-04-10 04:15:10

4. Hi,

This is really urgent... my cod

View Tutorial          By: Benetha at 2012-04-09 05:57:45

5. i totally disagree with Gerardo Saldí[email protected] i
View Tutorial          By: Shivesh at 2009-09-24 23:46:42

6. Very clearly explained...
View Tutorial          By: Bina at 2010-04-08 06:56:37

7. How to print lee alone for the eg above........I n
View Tutorial          By: sa at 2013-04-01 07:43:03

8. so how can i run this project
View Tutorial          By: milinda at 2010-12-17 10:01:23

9. pls send simple to hard j2me coding
View Tutorial          By: Seenu at 2008-10-29 15:19:03

10. we need to know how to write this coding..

View Tutorial          By: lalala at 2009-07-15 20:35:16