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
Difference between vector and arraylist.
What are actual parameters?
What restrictions are placed on method overriding?
If a class is declared without any access modifiers, where may the class be accessed in java programming?
What is the syntax and characteristics of a lambda expression?
What is the difference between stringbuffer and stringbuilder class?
Can we serialize singleton class?
How to compare two strings in java program?
What is the difference between a local variable and an instance variable?
What is "this" keyword in java? Explain
What is the definition of tree ?
Why we used break and continue statement in java?
what is object-oriented programming in java?
What is the use of singleton?
Can you override static methods?