No it doesn't.
Does the real class maybe have a constructor?
And does that constructor maybe also call new on itself?
If so, what do think will happen if every call to new results in another to call new?
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
Because without the static, that Test t = new Test(); is an instance variable, that is instantiated with every call to new. So, you call new Test() in main, which triggers another new Test, which triggers another new Test, which triggers another new Test, which triggers another new Test, which trig.....
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
The code does not give any stack overflow error.
it runs fine.
Which has already been covered. Did you read the thread or just knee jerk reply without bothering to find out what has gone before?
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
Yes i didnt see that properly.My mistake.
some people do think themselves smart using slang languages, you are indeed one of them.
anyways..
I do recommend you take time to read other responses as often people will reply to something that was already corrected and then wonder why they are hatted by masses. Flaming other and calling him "smart mouth" because he highlighted your mistake is bad idea, you would better do just saying "I'm sorry, my bad".
If you ignore previously provided feedback on this forum or real life you are more likely to fail on next step...
peter_budo
Code tags enforcer
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902