Can a class be a super class and a sub-class at the same time? Give example.



Can a class be a super class and a sub-class at the same time? Give example...

Answer / 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

More Core Java Interview Questions

A non-static inner class may have object instances that are associated with instances of the class’s outer class. A static inner class does not have any object instances.

0 Answers  


Can a class have multiple subclasses?

0 Answers  


Is string an object?

0 Answers  


What variables are stored in stack?

0 Answers  


Can an integer be a string?

0 Answers  


How do I start learning java?

0 Answers  


What is difference between path and classpath in java?

0 Answers  


What is an array and a vector? How they different from each other?

4 Answers  


how to use this key word in java programming?

7 Answers  


whats the life cycle of jsp

2 Answers   Satyam,


what is deadlock? : Java thread

0 Answers  


how to write a program for sending mails between client and server

0 Answers   Lampex,


Categories