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 operators and its types?

583


How do you check if a number is a perfect square?

522


Is java pass by value or pass by reference?

550


what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent

1739


List some important features of java 10 release?

525






What is difference between java and java ee?

566


What are structs in java?

591


What does i ++ mean in Java?

511


How do you join strings in java?

532


What methodology can be employed to locate substrings inside a string?

541


Similarity and difference between static block and static method ?

545


Define a java class.

811


What is the difference between inner class and nested class?

557


Why multiple inheritance is not supported by java?

522


What sorting algorithm does javascript use?

539