class a extends b
{
}
class b extends a
{
}

why java doesn't support cyclic pls explain me with example

Answer Posted / kaustav chatterjee

Every class in java by default extends the Object class and they have to cause java is almost an object oriented language.but if we take this scenario where class B extends class A and class A extends class B then as java don't support multiple inheritance or multiple super class then class A cannot extend the Object class and cannot be a Object type or subclass of Object class but by definition of JAVA every class is a subclass of Object class.Hence it's not supported by JAVA as it contradicts basic definition of JAVA.

but if we don't extending any class in class A then it by default extends Object class and class B by extending class A also extending Object class.so there is no problem.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 6 mandatory procedures for iso 9001?

527


Explain different ways of creating a thread. Which one would you prefer and why?

575


What does isempty () do in java?

598


How do you check if two given string are anagrams?

551


What is static keyword in java?

547






What is reflexive association?

1003


What is autoboxing in java?

605


List the three steps for creating an object for a class?

515


Explain the difference between collection api and stream api in java8?

505


what is static import in java? Explain

551


Difference between object instantiation and construction ?

580


How are destructors defined in java?

569


Explain the difference between comparator and comparable in java?

483


What does the exclamation mark mean in java?

587


What is pangram in java?

509