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 I want to read input from A PDF what should I d
View Tutorial          By: thiru at 2015-08-12 10:57:51

2. hi ,
i tried the code given, the connect

View Tutorial          By: barani at 2010-05-27 05:32:11

3. haii , i am fully happy by searching all component
View Tutorial          By: AJEET KUMAR DALEI at 2011-04-23 21:20:00

4. Do the serialized output is displayed in the file
View Tutorial          By: Atihs at 2012-11-17 02:38:52

5. Thnks, such a basic example to understand. Keep it
View Tutorial          By: Pradeep Singh at 2012-10-11 04:24:54

6. Hello, I have executed the above code and it works
View Tutorial          By: Sana at 2010-02-01 03:50:18

7. hi
i try to write a code for send data or s

View Tutorial          By: mjh at 2011-02-16 08:26:10

8. Thanks it worked. Just remember to restart apache
View Tutorial          By: Raj at 2014-02-08 08:42:26

9. i want every important questions in .net 3.5 and j
View Tutorial          By: pawan at 2011-07-28 06:17:25

10. sach a lovely exmpl for bgnrs thanks
View Tutorial          By: aaditya at 2013-01-13 08:05:03