posted 18 years ago
Dear Seema,
Both code fragments can compile and both raises StackOverFlowError just because when you create and instance the JVM automatically creates another instance to assign to inc member and so on. The program enters in a infinite recursive calls.
I think you are trying to do something like a list where a node points to another node and so on.
So, I belive the code below would be suitable for you.
"If someone asks you to do something you don't know how to, don't tell I don't know, tell I can learn instead." - Myself