Can a class be a super class and a sub-class at the same time? Give example.
If there is a hierarchy of inheritance used, a class can be a super class for another class and a sub-class for another one at the same time.
In the example below, continent class is sub-class of world class and it’s super class of country class.
public class world {
..........
}
public class continenet extends world {
............
}
public class country extends continent {
......................
}
| Is This Answer Correct ? | 0 Yes | 0 No |
what do you meant by Runtime Polymorphism?
13 Answers BVIMR, IBM, Persistent,
for what purpose we use applets ?
what is the difference between the "protected and default" modifiers?
There are 2 classes, 1 LandAnimal and another WaterAnimal. There is another class Animal which wants to have the properties of both LandAnimal and WaterAnimal. How will you design this situation?
How can we find the sum of two linked lists using stack in java?
what is java bean?where can we use it?
When will we use them?
What is run time allocation?
What is the difference between Trusted and Untrusted Applet ?
What is the exact difference in between Unicast and Multicast object? Where will it be used?
what is the difference between the methods sleep() and wait()? : Java thread
class A { private int i; } class B extends A { private int i; } if I create an object of B class what will be the memory of that object.