class a extends b
{
}
class b extends a
{
}
why java doesn't support cyclic pls explain me with example
Answers were Sorted based on User's Feedback
Answer / lakshminarayana
IN THE FIRST BLOCK CLASS IS EXTENDING CLASS B.HERE A IS SUB
CLASS OF CLASS B.
AGAIN CLASS B IS EXTENDING CLASS A WHICH IS A SUB CLASS OF
B.A SUB CLASS NEVER BECOME A SUPER CLASS FROM WHICH IT IS
EXTENDED. SO IN JAVA IT THROWS A EXCEPTIONS LIKE CYCLIC
INHERITANCE NOT POSSIBLE...
... I THINK IT WILL HELPFUL FOR U.
| Is This Answer Correct ? | 30 Yes | 2 No |
Answer / 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 |
Answer / anandhi
java is nt support multiple inheritance... so we have go to
nxt level interface program... we will use interface
concept then this pgm possible
| Is This Answer Correct ? | 1 Yes | 17 No |
What is composition in java?
What is the order of method invocation in an Applet?
Explain why wait(), notify() and notifyall() methods are in object class rather than in the reading class?
What are order of precedence and associativity, and how are they used?
What is thread life cycle in java?
how a programmer confirms that the data submitted has been succesfully inserted into the database(either oracle or my sql).. How a programmer confirm if there is any problem with the program he wrote for insertion
what is the replacement for GOTO in java?
Which is better 64 bit or 32 bit?
Ducking is automatic in checked exception?True or false
Difference between ‘>>’ and ‘>>>’ operators in java?
What does microservices mean?
How can you traverse a linked list in java?