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. Fine,you r very straightforward I like that

View Tutorial          By: Shaiju at 2010-02-21 10:15:00

2. hiii frds i want to run this program can i run usi
View Tutorial          By: arun kumar ojha at 2011-07-20 00:59:10

3. can any body help me,i need to send a sms from sim
View Tutorial          By: vinayaka DJ at 2011-11-14 12:44:01

4. it was very usefull.....thanks :)
View Tutorial          By: qwerty at 2010-04-04 05:48:07

5. using a same name ,return type and parameter type
View Tutorial          By: sam at 2011-06-24 15:13:34

6. What's with the \ " ?
Your code doesn

View Tutorial          By: Dan at 2011-12-29 10:20:08

7. It's really helpful , thanks a lot
View Tutorial          By: Avijit at 2009-09-08 05:18:39

8. Thanks,It's perfect solution,I solved my probleam
View Tutorial          By: Suryaprakash Raghuwanshi at 2009-07-04 19:06:24

9. does this code work with netbeans. if not can anyo
View Tutorial          By: Alton at 2010-04-02 22:36:57

10. hi,
can you send me more examples regarding

View Tutorial          By: Ram M at 2015-10-05 06:32:27