What is the difference between overloading and overriding a
function?

Answers were Sorted based on User's Feedback



What is the difference between overloading and overriding a function?..

Answer / ankur dhoot

In overloading two function should have different signature
but overriding show have exactly same signature.

Overloading generally happens in same class but overriding
mandatory requires super and sub class to happen.

Compiler decides overloading at compile time but overriding
is detected at run time.

Overloading is called static polymorphism while overriding
is called dynamic polymorphism.

Is This Answer Correct ?    53 Yes 6 No

What is the difference between overloading and overriding a function?..

Answer / sai

overloading takes place at compile time and overriding
takes place at run time.

Is This Answer Correct ?    28 Yes 7 No

What is the difference between overloading and overriding a function?..

Answer / karthik

Overload :Deals single class bluebrint method selection
by using diffent proto type
(static buinding)


Overriding :Deals sub and super class bluebrints method
selection by using same proto type
(Dynamic buinding)

Is This Answer Correct ?    16 Yes 2 No

What is the difference between overloading and overriding a function?..

Answer / suganthi

Over Loading : when two or methods share the same name but
paramater declaration are diffierent with in a class.
(ex:Compile time polymorpism)

Over ridding: when two or methods share the same name but
paramater declaration are also same in different classes.
(ex:run time polymorpism)

Is This Answer Correct ?    17 Yes 3 No

What is the difference between overloading and overriding a function?..

Answer / raj kashyap

OVERLOADING is possible to create methods that have the same
name, but different parameters lists and different
definitions.overloading is used when objects are required to
perform similar task but using different parameters.



OVERRIDING is used when we want an object to respond to the
same method but have different behaviour when that method is
called. that means we override the method defined in super
class.yhis is possible by defining a method in subclass that
has same name,same argument& same return typeas method in
super class.

Is This Answer Correct ?    12 Yes 2 No

What is the difference between overloading and overriding a function?..

Answer / jitesh singh

OVERLOADING is done in the same class with different
singnature or parameter pass in the function

OVERRIDING is done in different class but the signature or
the parameter is same

Is This Answer Correct ?    12 Yes 3 No

What is the difference between overloading and overriding a function?..

Answer / smita

overloading method :- is sem class in defintoin.
overriding method:- is subclass and super class in
definatioc

Is This Answer Correct ?    4 Yes 1 No

What is the difference between overloading and overriding a function?..

Answer / praveen

Over riding also can be happens in the same class

eq :-

public void test(int i)
{
System.out.println(i);
}
public void test(String i)
{
System.out.println(i);
}

Over Loading - Compile time polymorphism
Over Riding - Run time polymorphism

Is This Answer Correct ?    5 Yes 3 No

What is the difference between overloading and overriding a function?..

Answer / ankit

IN overloading the function are used in same class, they
have different parameters each time we define the funtion,
and perform the same task.

overriding is used in diferent class with same parameters.

Is This Answer Correct ?    2 Yes 1 No

What is the difference between overloading and overriding a function?..

Answer / ghanshyam dobariya

OVERLOADING: Declaration and definition are in the same
class i.e. a class in which they are defined.

OVERRIDING:Declaration is done at super class while actual
definition is define in sub class.

OVERLOADING: Any code mistake we make in defining it's code
, detected at compile time

OVERRIDING: Any code mistake we make in defining it's code
,detected at run time.

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More Core Java Interview Questions

Is there any case when finally will not be executed?

0 Answers  


Can we override the overloaded method?

0 Answers  


what is the replacement method of stop() of thread

8 Answers   IBM, TCS,


How do you write a scanner class in java?

0 Answers  


What are the drawbacks of reflection?

0 Answers  






What is generics in java interview questions?

0 Answers  


Can a function return a function?

0 Answers  


What is the difference between a static and a non-static inner class in java programming?

0 Answers  


Thanks A.jyotsna, Can u tell me differnce between abstract class and interface vikash

4 Answers  


List some oops concepts in java?

0 Answers  


when a request is generated from apache tomcat 5.5 and goes to oracle 10g or mysql,,, how the oracle or mysql reads the request as apache is a web server and oracle 10g is application server? when the oracle 10g provides response, how the apche tomcat reads it???

0 Answers   SAP Labs,


why there are multiple catches for a try block.don't tell me that there can be multiple exception of a code segment that's why.tell me the real fact behind this.

4 Answers  


Categories