GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Manhattan Associates  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 4 of 17    Print  
What is the difference between OVERRIDING and OVERLOADING

  
Total Answers and Comments: 9 Last Update: June 14, 2009   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 09, 2005 07:34:30   #1  
Hari        

RE: What is the difference between OVERRIDING and OVERLOADING
Overriding - same method names with same arguments and same return types associated in a class and its subclass.

Overloading - same method name with different arguments may or may not be same return type written in the same class itself.

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
June 13, 2005 02:57:11   #2  
varsha        

RE: What is the difference between OVERRIDING and OVERLOADING
Ya.. u can also sau that Overloading is static Polymorphism and Overridding is dynamic polymorphism.
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
July 03, 2005 11:03:55   #3  
Sony        

RE: What is the difference between OVERRIDING and OVERLOADING
the best answer is that both overloading and over-riding are different aspects of polymorphism.......;-)

static/early binding polymorphism:overloading
dynamic/late binding polymorphism:overriding

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
February 07, 2007 07:08:11   #4  
Jayaprabhakar        

RE: What is the difference between OVERRIDING and OVER...
Overloading is compile time binding where as overriding is dynamic binding.A good example that differentiates between overloading and overriding is shown here.

overriding is compile time binding

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
October 06, 2007 13:47:59   #5  
ramana        

RE: What is the difference between OVERRIDING and OVER...
Please clarify the difference
class A
{
void calc()
{
}
int calc(int)
{
}
}
class B:public A
{
void calc()
{
}
}

This is just an abstract of the program.
If we have a program like this and an object of class B is created and we call b.calc will the compiler first call the method calc of super class or sub class?
What will be the effect of virtual key word on this program?
Is the calc function over loaded?
Can we say this as an example for over riding?

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
October 11, 2007 10:06:41   #6  
Blah        

RE: What is the difference between OVERRIDING and OVER...
Please clarify the difference
class A
{
void calc()
{
}
int calc(int)
{
}
}
class B:public A
{
void calc()
{
}
}

This is just an abstract of the program.
If we have a program like this and an object of class B is created and we call b.calc will the compiler first call the method calc of super class or sub class?
What will be the effect of virtual key word on this program?
Is the calc function over loaded?
Can we say this as an example for over riding?

-------------------------------------------------------------------------
In this case when class B calls a.calc the complier will first look at the signature of calc. Class B needs to either call a.calc() or a.calc(int).

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
February 18, 2009 02:46:30   #7  
Anil Singh Member Since: February 2009   Contribution: 1    

RE: What is the difference between OVERRIDING and OVERLOADING
Overloading: Methods name same but signatures is different in the class.

Example:

class b{

public void add(int i int j){
int n i+j;
System.out.println(n);
}
public void add(int i int j int k){
int n i+j+k;
System.out.println(n);
}
public void add(int i int j int k int l){
int n i+j+k+l;
System.out.println(n);
}
public static void main(String []aa){
b b1 new b();
b1.add(1 2 5);
}
}
output: 8

Overriding:To redefine the base class method in the derived class is called overriding.

Example:

class a{

public void display(){
System.out.println( it is a firest class method );
}
}
class overiding extends a{

public void display(){
System.out.println( it is a Second class method );
}
public static void main(String []anil){
overiding obj new overiding();

obj.display();

}
}
output: it is a Second class method

 
Is this answer useful? Yes | No
February 19, 2009 13:21:52   #8  
milan.kadivar Member Since: February 2009   Contribution: 4    

RE: What is the difference between OVERRIDING and OVERLOADING
Overloading: The methods with the same name but it differs by types of guments and number of arguments.

Overriding: The methods with the same name and same number of arguments and types but one is in base class and second is in derived class.

 
Is this answer useful? Yes | No
June 12, 2009 22:14:18   #9  
kamesh23 Member Since: February 2009   Contribution: 1    

RE: What is the difference between OVERRIDING and OVERLOADING
OvERLOADING: Same function with different arguments
ADDITION(int x int y) ADDITION(int x int y int z)
{ {
------------------------- ---------------
-------------------------- -------------------
} }
OVERRIDING: Same function with same arguments

ADDITION(int x int y) ADDITION(float x float y)
{ {
------------------------- ---------------
-------------------------- -------------------
} }

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape