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. sir, i want to learn java please help me.
View Tutorial          By: nitin mittal at 2013-12-23 10:04:11

2. hi i am studying java course.i am new to java, ple
View Tutorial          By: Rajeshkumar at 2011-11-14 08:30:29

3. Thanks for the article. I got some clearance now.
View Tutorial          By: Reddy at 2008-03-15 00:02:17

4. Excellent site.
View Tutorial          By: anonymous at 2011-11-06 12:07:14

5. It too good code
View Tutorial          By: Srinivas at 2011-02-20 03:58:19

6. Hay can you send me complete code to make connecti
View Tutorial          By: 9COOL at 2010-02-22 08:10:47

7. Sir , I am doing BCS . I want to know more about
View Tutorial          By: Sachin deshmukh at 2010-08-04 02:24:59

8. I am new to J2ME but this was really help full and
View Tutorial          By: Subhash at 2013-05-05 08:57:38

9. i am in beginning level, i tried by this code. but
View Tutorial          By: Shahana Akter at 2014-09-09 10:30:21

10. Sir, plz tell me how can I run the speech class in
View Tutorial          By: Nitin Govil at 2012-01-21 10:14:52