ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
Difference between overloading and Overriding. <Giving a 
confusing example to test the concept.>
(also asked in PA Consultancy Group,iflex,Value 
chain,IBM,CTS,Accenture, Tarang>
 Question Submitted By :: Esha Prasad
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Difference between overloading and Overriding. <Giving a confusing example to test the concept.> (also asked in PA Consultancy Group,iflex,Value chain,IBM,CTS,Accenture, Tarang>
Answer
# 1
Over loading is polymorphism implementation in same class, 
where two or more methods can share same name differing in 
parameters passed.
Overriding is polymorphism implementation in different 
classes having parent child relationship and the 
funtionality in parent class is over shadowed by the 
funtionality in subclass.
 
Is This Answer Correct ?    11 Yes 1 No
Esha Prasad
 
  Re: Difference between overloading and Overriding. <Giving a confusing example to test the concept.> (also asked in PA Consultancy Group,iflex,Value chain,IBM,CTS,Accenture, Tarang>
Answer
# 2
Overloading class has different returntype.
overloading comes with in class but overriding comes in two 
classes.
Overloading is resolved at compiletime
Overriding is resolved at runtime.
 
Is This Answer Correct ?    6 Yes 4 No
Rakesh
 
 
 
  Re: Difference between overloading and Overriding. <Giving a confusing example to test the concept.> (also asked in PA Consultancy Group,iflex,Value chain,IBM,CTS,Accenture, Tarang>
Answer
# 3
overloading means same method name but different parameters 
are passed but overriding means same method name with same 
parameters passed in different classes.
 
Is This Answer Correct ?    2 Yes 4 No
Arthi
 
  Re: Difference between overloading and Overriding. <Giving a confusing example to test the concept.> (also asked in PA Consultancy Group,iflex,Value chain,IBM,CTS,Accenture, Tarang>
Answer
# 4
overloading : can only be done by changing the type or no.
of parameters for eg:a(int a);
a(int a,int b);


while in case of overriding we can give new definition
without changing the parameters.
 
Is This Answer Correct ?    4 Yes 1 No
Varun
 
  Re: Difference between overloading and Overriding. <Giving a confusing example to test the concept.> (also asked in PA Consultancy Group,iflex,Value chain,IBM,CTS,Accenture, Tarang>
Answer
# 5
Function Overloading
class A
{
int show(int a,float b)
float show(int a,int b)//different prototype can valid but 
as per parameters they called
}
Function overriding
class A
{
int show(int a)
};
class B : public A
{
int show(int a)//function prototype of base class fun n 
derived class function must be same
}
 
Is This Answer Correct ?    2 Yes 1 No
Priyanka Patil
 
  Re: Difference between overloading and Overriding. <Giving a confusing example to test the concept.> (also asked in PA Consultancy Group,iflex,Value chain,IBM,CTS,Accenture, Tarang>
Answer
# 6
overriding is only possible in case of inheritance,bt 
overloading is possible incase of both inheritance & same 
class.
class A
{
public int add();
public float sub();
public float multi(float a,float b){}
public double div(double d,double e){}
}
class B extends A
{
public int add(int a,int b){}//must be same as declared  in 
super class
public float sub(float a,float b){}//must be same name same 
returntype same as declared
public float multi(float a,float b,float c){}

}
 
Is This Answer Correct ?    0 Yes 0 No
Kabita
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
What is the range of the short datatype?  2
what is the life cycle of jsp? Photon2
Hi Friends, can you explain instance in java. In general instance means "occurence of something" . In java what is instance.  2
Which all r Final classes in java except string?  3
What is a Wrapper class?  9
what is main difference between architecture,framework and design pattren  1
What is anonymous class?  2
Why to give the file name same as the public class name in java?  3
What are virtual functions?  2
what is meaning of JIT?  4
Is ResultSet class? Bally-Technologies2
my method "abc" return array of interface "xyz" and "pqr" is abstract class implements abc and class "jkl" extends pqr My problem 1) when i call abc it retrun array xyz how can i do this hint xyz refer_xyz = new jkl(); but i can't create array. 2)I want to access method of jkl using reference of xyz??  1
What are Access Specifiers and Access Modifiers. TCS4
What is ResourceBundle class?  1
What is Transient and volatile iFlex9
What is meant by throwing an Exception? Accenture4
What is the difference between overloading and overriding a function? Infosys7
How a class can implement an interface? SysArc4
what's diff between struts 1.1 & 1.2 Wipro2
Is it possible to write static method in abstract class? justyfy your answer? Hexaware3
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com