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


Please Help Members By Posting Answers For Below Questions

What will be the initial value of an object reference which is defined as an instance variable?

629


How do you implement singleton class?

511


What is the preferred size of a component in java programming?

535


Why can't we override private static methods?

511


explain the difference between jdk and jvm?

555






How does linkedlist work in java?

503


What is the purpose of lambda expressions?

580


Can we override compareto method?

496


I want to print “hello” even before main is executed. How will you acheive that?

650


What is percentage in java?

566


What is the purpose of the return statement?

508


What are the 4 types of research methods?

507


Can long be null in java?

540


Can inner class final?

630


List out five keywords related to exception handling ?

596