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
What is garbage collection? Can it be forced to run?
What does opcode mean?
What is a stack class in java ?
Is array size fixed in java?
what is meant by Byte code concept in Java?
What is the purpose of the system class in java?
Why string is not thread safe?
What is t in generics in java?
How many decimal digits is 64 bit?
How can u increase the heap size in the memory?
What is an empirical question?
Why null value is used in string?
Why do people says “java is robust”?
Is overriding possible in java?
how to create multithreaded program? Explain different ways of using thread? : Java thread