Answer Posted / shiry
In C++ ;
if i have 2 clases
class A {
int x();
}
class B : public A {
int x();
}
void main(){
A* a = new B() ;
a.x(); // it will call the method of the super class A
// not B but in java it will call the method in the
// child B why ??
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Can I declare class as static or private?
Why can't you declare a class as protected?
What does flag mean in java?
What is the common usage of serialization? What exceptions occur during serialization?
What is java util hashmap?
What's the default access specifier for variables and methods of a class?
What is the vector class in java programming?
Which types of exceptions are caught at compile time?
Why do we need hashset in java?
How will you print number in reverse (descending) order in BST.
What is the latest java version?
Can you extend main method in java?
What is java and their uses?
What's the difference between comparison done by equals method and == operator?
Which arithmetic operations can result in the throwing of an arithmeticexception?