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                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   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
what is the purpose of method overriding in java where v r
completely re-defining a  inherited method instead y can't v
create a new method and define.If the question is very silly
plz excuse me and do reply.Thank U!
 Question Submitted By :: AnithaBabu1
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is the purpose of method overriding in java where v r completely re-defining a inherited method instead y can't v create a new method and define.If the question is very silly plz excuse me and do reply.Thank U!
Answer
# 1
The answer lies in Object Oriented concept. When you are
overriding a method, you overriding the internal details of
default behavior.  But your interface to external world is
not changed. Example, Base class employee has a method
commuteToWork(). All the manager in the company has given
the company car and a driver. Their implementation of
commuteToWork will be different from the non manager
employees.  If you add a new method saying
commuteToWorkByCar(), every Monday morning you would need to
call different method for each subtype of employee.  Hope it
will help.
 
Is This Answer Correct ?    1 Yes 0 No
Kv
 
  Re: what is the purpose of method overriding in java where v r completely re-defining a inherited method instead y can't v create a new method and define.If the question is very silly plz excuse me and do reply.Thank U!
Answer
# 2
hi
   MethodOverriding is the concept which implements Dynamic 
Code(Method) binding.
   i.e., The method which is going to bind or execute is 
decided at the runtime basing on the Object that we are 
using to call that method...
 Suppose assume we have two Classes A,B Where class B is 
inheriting class A.And even we have overridden(given 
different implementation with same method signature)a 
method of class A in class B.
   Now the criteria is which method(superclass method or 
subclsas overridden method) is to be called or executed is 
determined based on the object(class A object Or class B 
object) we are using to call that method............
 
Is This Answer Correct ?    0 Yes 0 No
Imambasha
 
 
 
  Re: what is the purpose of method overriding in java where v r completely re-defining a inherited method instead y can't v create a new method and define.If the question is very silly plz excuse me and do reply.Thank U!
Answer
# 3
Bcoz......wen we think in Object Oriented Lang ..has u ask 
if we create a new method we hav to call the method each 
time wen we invoke the Object & it is a performance ISSUE 
it wil eat lot of memory & it is a COMPLEXITY 
Issue  ........if u override Using the superclass Handle we 
can create  any instance which is of any type(int Float 
Long Short)it wil save space and reduce COMPLEXITY and 
increase PERFORMANCE...
 
Is This Answer Correct ?    0 Yes 0 No
Ershad Md Sk
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
What is a serializable interface?  3
what is the difference between @include page and @include file  1
different types of threads? TCS5
When we can access the static data member without creating the object what is the need of the object in java.  1
What is method Overriding in the perspective of OOPS?  1
what is bytecode ?explain in detail and watz the difference between bytecode and machine code? Lucent2
can we add two numbers without using arthematic operators? if possible how?  1
What is deadlock and how to avoid this?  2
What is data abstraction? Elaborate with example? BMC1
What are the parameters used in Connection pooling? IBM1
Name the class that used to read objects directly from a stream? Wipro2
static inner classes means..?  1
In Serialization, whether you will use Static variables? HCL2
What modifiers can be used with a local inner class?  2
What is an exception?  3
Hey buddy.. can you please tell me about the use of marker interface? And is there any link between marker interface and factory methods? Thanks in advance.  2
What is the argument type of main() method?  2
what are the oops concept in java explain with real time examples Tech-Mahindra2
What is an event?  1
What is encapsulation? Elaborate with example? BMC1
 
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