Can a class be a super class and a sub-class at the same time? Give example.
Answer Posted / hrindows@gmail.com
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 |
Post New Answer View All Answers
Why constructor has no return type?
Which are the two subclasses under exception class?
Why we go for collections in java?
What are the differences between this and super keyword?
Is string a class in java?
What does sprintf mean?
What is ternary operator?
What is consumer interface?
Is main a keyword in java?
How will you calculate the depth of a binary tree if the tree contains 15 nodes?
What are keywords give examples?
Can an anonymous class be declared as implementing an interface and extending a class in java programming?
how many types of Inheritance?
Difference between a process and a program?
Difference between final and effectively final ?