Answer Posted / vijayakumar chinnasamy
In Java Method overriding is the runtime or late binding
polymorphism.
class object is determine which class method is invoked.
ex:
class A {
protected void display(){ }
}
class B extends A {
protected void display(){ }
}
class MainClass {
public static void main(String arg[]){
A objA=null;
objA=new B();
objA.display(); // it invoke the Class B's display()
objA=new A();
objA.display(); // it invoke the Class A's display()
}
}
Note: the class's object only determine which method to call.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Do you need to import math in java?
What is a parameter example?
What is the static block?
How will you communicate between two applets?
What mechanism does java use for memory management?
How do you write a scanner class in java?
How can constructor chaining be done by using the super keyword?
What are the three best choices for a development environment?
Which is better 64 bit or 32 bit?
How we can run a jar file through command prompt in java?
How are multiple inheritances done in Java?
Explain the key functions of data binding?
What is the basic of java?
What is the difference between Array and Hash Table?
Does java vector allow null?