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



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. Thanks!! This example was very helpful for me...
View Tutorial          By: Jonathas at 2010-03-11 07:47:51

2. nice///
View Tutorial          By: MHARLON ALADEN at 2009-08-14 01:00:09

3. wonderful
simplified description
ke

View Tutorial          By: ephrem at 2010-01-14 06:12:05

4. This website is great for the students who want to
View Tutorial          By: Parth Patalia at 2009-11-19 21:09:24

5. I used a txt file and stored it under my drawable
View Tutorial          By: Sara at 2014-09-18 16:33:30

6. how to create inode address using c++
View Tutorial          By: pooja at 2014-06-24 05:50:33

7. Sencillo y directo. No se podía explic
View Tutorial          By: Eligio at 2013-09-03 05:26:35

8. i really hate do while loop statement, can u pls h
View Tutorial          By: mARjO at 2011-09-01 03:50:18

9. sir i need some simple example of jdbc i cannot un
View Tutorial          By: sumit at 2011-11-26 18:02:14

10. Gracias, it worked.
View Tutorial          By: Eduardo at 2009-09-09 12:16:30