All code in my posts, unless a source is explicitly mentioned, is my own.
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
All code in my posts, unless a source is explicitly mentioned, is my own.
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Originally posted by Ruben Soto:
That's a good point, thanks. The main thing is not to initialize the member.
All code in my posts, unless a source is explicitly mentioned, is my own.
Back to my question, how could you avoid the stack overflow in the above scenario then? I'm sure I must be missing something.
All code in my posts, unless a source is explicitly mentioned, is my own.
but your code deviates from the premise that the recursive instance member must be initialized in the top-level of the class in which it is defined (not within any method, because in that case it is not a top-level initialization.)
All code in my posts, unless a source is explicitly mentioned, is my own.
All code in my posts, unless a source is explicitly mentioned, is my own.
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|