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
How does the java compiler work?
What is the difference between break and continue statements?
What is the difference between sleep and wait in java?
Give an example of call be reference significance.
What ide should I use for java?
How do you sort a set in java?
Why does java not support operator overloading?
What is size () in java?
What are the steps involved to write rmi based programs?
Can list contain null in java?
Which one will take more memory: an int or integer?
What is the difference between int and integer in java?
What is the difference between variable declaration and variable initialization?
How can you make a class serializable in java?
what methods would you overwrite in java.lang.object class?