when the definition of that class isnt finished yet.
It is finished. Would it be more readable that way ?
Campbell Ritchie wrote:Please always tell us what the question is about.
Sorry. Ive corrected the mistake.Now Back to the question.
But doesnt it sound recursive ?
According to this Class definition, when an instance object of this Class is created, another instance object of the same Class is needed to be created inside the second. For the second object , a third one is needed to be created inside and it needs to go on like this.
I know it is a problem with my understanding of this. Anybody correct me.
Wouter Oet wrote:You're correct. It is recursive. You could "fix" it like this:
OK. Here new Test() wont get executed when a Class object is created and we need to explicitly call it.
Mine is not a specific coding problem but rather a probelm with my understanding. So what is actually going on in my first example.
How much Test objects will be created when we create the first instance of Test Class?
Rob Prime wrote:Just never try to create instances. If you create an instance, that will create an instance, that will create an instance, and so on until a StackOverflowError is thrown.
Sorry. Late to notice this.
Can anybody give me the smallest code to cause this StactOverFLowError