Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Dummy Assignment

1 answer below »
Answered 10 days After Feb 10, 2021

Solution

Kshitij answered on Feb 21 2021
141 Votes
Ques no 1:---

Dynamic Binding :-
It is also called 'Late Binding' . The compiler is not resolve the method
call at the compile time.
Ex-> Method ove
ide calling from the object

package feb21_21.DB;
public class DynamicBinding {
public static void main(String[] args) {
Airplane myAirplane= new Jet();

object reference is from the child class

the reference variable if from the parent class

We can store the reference value of the object of the child class,

inside the reference variable of its parent class, but not vice
versa

Now the compiler has to be confused
myAirplane.display();

compiler simply go to Jet class if method is available the simply
un otherwise go to parent class

This is confusing for compiler

This problem is resolving at the runtime
}
static class Airplane{
public void display(){
System.out.println("Airplane class");
}
}
static class Jet extends Airplane{
@Ove
ide
public void display(){
System.out.println("Jet class");
}
public void displayFuelStatus(){
System.out.println("Tank is full");
}
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here