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
Does the order of public and static declaration matter in main method?
What is the major difference between linkedlist and arraylist?
What will happen if a thrown exception is not handled?
What do you understand by an io stream?
How do you check if an arraylist is not empty?
How can we pass argument to a function by reference instead of pass by value?
Write code to implement bubble sort in java?
List some oops concepts in java?
is there a separate stack for each thread in java? : Java thread
How many JVMs can run on a single machine and what is the Just-In-Time(JIT) compiler?
What does indexof mean?
How do you represent a space in regex java?
What is the purpose of the file class in java programming?
What is the loop in java?
What do negative exponents mean?