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
What will be the initial value of an object reference which is defined as an instance variable?
How do you implement singleton class?
What is the preferred size of a component in java programming?
Why can't we override private static methods?
explain the difference between jdk and jvm?
How does linkedlist work in java?
What is the purpose of lambda expressions?
Can we override compareto method?
I want to print “hello” even before main is executed. How will you acheive that?
What is percentage in java?
What is the purpose of the return statement?
What are the 4 types of research methods?
Can long be null in java?
Can inner class final?
List out five keywords related to exception handling ?