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

How does the java compiler work?

740


What is the difference between break and continue statements?

799


What is the difference between sleep and wait in java?

726


Give an example of call be reference significance.

808


What ide should I use for java?

730


How do you sort a set in java?

725


Why does java not support operator overloading?

903


What is size () in java?

825


What are the steps involved to write rmi based programs?

781


Can list contain null in java?

885


Which one will take more memory: an int or integer?

981


What is the difference between int and integer in java?

780


What is the difference between variable declaration and variable initialization?

748


How can you make a class serializable in java?

780


what methods would you overwrite in java.lang.object class?

763