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. This came out of a book
View Tutorial          By: Kyle Bradley at 2010-04-12 19:48:12

2. Sorry, please disregard my previous comment... Tha
View Tutorial          By: choco at 2010-01-03 02:21:09

3. I tried this code,but is showing this error

View Tutorial          By: anju at 2009-05-22 07:42:11

4. I have a problem with PortInUseException. I wrote
View Tutorial          By: robert at 2009-12-28 08:37:49

5. hi,
my problem is.......
i use vb.ne

View Tutorial          By: Anirban at 2009-10-25 10:15:13

6. Hi puru, The syntax is substring(int startIndex, i
View Tutorial          By: Fazal at 2008-09-12 20:17:53

7. for me also The code gives the following exception
View Tutorial          By: Nilesh Agrawal at 2012-06-06 15:55:02

8. hi
I have to learn java using NetbeansIDE

View Tutorial          By: Ekanki at 2011-08-04 10:30:36

9. This example is working fine....I think BillGates
View Tutorial          By: Monoj Rath at 2010-07-15 01:27:51

10. thank you sir
View Tutorial          By: ramya at 2010-01-11 00:42:05