ALLInterview.com :: Home Page            
 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                      
Google
   
 
Categories >> Software >> Java Related >> Java J2EE >> Core Java
 
 


 

 
 Core Java interview questions  Core Java Interview Questions (1722)
 Advanced Java interview questions  Advanced Java Interview Questions (331)
 Swing interview questions  Swing Interview Questions (44)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (196)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (147)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
Question
what is dynamic method dispatch ?
 Question Submitted By :: Core-Java
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
Dynamic dispatch is a mechanism by which a call to
Overridden function is resolved at runtime rather than at
Compile time , and this is how Java implements Run time
Polymorphism.
 
Is This Answer Correct ?    77 Yes 5 No
Penchala
 
Answer
# 2
Ex:
class A
{
public void m1()
{}
}
class B extends A
{
public void m1()
{
}
main()
{
A a=new B();//B reference will be assign at run time
a.m1();//class B method m1() will be called at runtime
}
}
 
Is This Answer Correct ?    73 Yes 16 No
Yayati Pavan Kumar
 
 
 
Answer
# 3
Dynamic Method Dispatch is Run -time Polymorphism which is
Method Overriding.
 
Is This Answer Correct ?    68 Yes 14 No
Rashmi
 
Answer
# 4
Java uses this fact to resolve calls to overridden methods
at run time. Here’s
how. When an overridden method is called through a
superclass reference, Java determines
which version of that method to execute based upon the type
of the object being referred to at the
time the call occurs. Thus, this determination is made at
run time with the help of dynamic method dispatch .
 
Is This Answer Correct ?    29 Yes 4 No
Arijit
 
Answer
# 5
super class reference variable refering to a subclass object
is called dynamic method dispatch.
 
Is This Answer Correct ?    32 Yes 8 No
Ravikiran
 
Answer
# 6
This is a unique feature in JAVA.as the name itself
suggests that it is related with run time.In this classes
has methods with same method name and signature.However
which method will b executed will be decided during run
time.
 
Is This Answer Correct ?    29 Yes 12 No
Rajashree
 
Answer
# 7
In dynamic method dispatch a reference of class can be
created and that can be used to executed overridden method
at run time.
 
Is This Answer Correct ?    20 Yes 5 No
Shanti Bhushan Singh
 
Answer
# 8
Dynamic method dispatch is the process the Java runtime
system uses to determine which method implementation to call
in an inheritance hierarchy. For example, the Object class
has a toString() method that all subclasses inherit, but the
String class overrides this method to return its string
content. If a String or other object type is assigned to an
Object reference using application logic, the Java compiler
cannot know in advance where a call to the toString() method
will be resolved, it must be determined dynamically at runtime.
 
Is This Answer Correct ?    7 Yes 3 No
Ramya
 
Answer
# 9
Dispatching call to a method at runtime by jvm.In dinamic
dispatch method invocation jvm identifies which should be
called
 
Is This Answer Correct ?    8 Yes 5 No
Srinivasa
 
Answer
# 10
class A{
void hallo(){
System.out.println(" hallo of A");
}
}
class B extends A {
void hallo(){ // method overridden.
System.out.println("hallo of B");
}
}
class C extends B {
void hallo(){ // method overridden
System.out.println("hallo of C");
}
}
class Demo {
public static void main(String[] args) {
A a = new A(); // create object of A
B b = new B(); // create object of B
C c = new C(); // create object of C
A r; // create a reference of super class
r=a; // assign object of A to the reference var. r
r.hallo(); // it calls hallo() of class A
r=b; // super class variable can reference a
sub class object.
r.hallo(); // it calls hallo() of class B
r =c; // super class variable can ref. sub
class object.
r.hallo(); // it calls hallo() of class C
}
}

this is how dynamic dispath method works.
overridden methods are resolved at run time rather than
compile time. At compile time it doesn't know which over-
ridden method will be called.
it comes to know at run time, thats why it is called as run
time polymorphism.
 
Is This Answer Correct ?    5 Yes 2 No
J Mathew
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
what is purpose of collections.unmodified() method..? Accenture 1
Is it compulsory to have atleast one abstract method in abstract class?   10
Can we add default constructor to Servlet? Fidelity 1
Can you run the product development on all operating systems ?   1
Howmany number of objects we can store in an ArrayList. Is there any limit? TCS 6
Hai friends I am MCA 2006 passout. Spend time in 1 yr for teacing and 5 months in small s/w firm. worked in 4 or 5 months in few places. Presently I am writing bank exams. I want to get back to IT sector. Are there any possibilities. any growth prospects?. I am having some knowledge in core and advanced java. I am so desperate. Any suggestions thanks in advance. u can write to my mail mahidestiny@gmail.com   4
Sample code to retrieve objects from HashMap in sorted ascending order?   2
What is a reflection package?   2
What is inheritance?   5
types of applets?. TCS 7
What is hypertext?   1
in a constructor what happen if u call super and this in the same class? i know that it is not possible to call both in the same one? if we call what will happen? ITC-Infotech 10
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com