hi all can any one tell me whats the problem in the below code
i am getting stack overflow erro when instantiating Temp1 new Temp1() gives me stackoverflow error
Stary Kapec
Ranch Hand
Joined: Dec 04, 2005
Posts: 81
posted
0
Hi,
Every time you create Temp1 instance you create another two Temp1 instances, and every time one of these two instances is created another two Temp1 instances are created and so on, and so on... The circular association in your class causes the problem. [ August 15, 2006: Message edited by: Jasiek Motyka ]
Sujittt Tripathyrr
Ranch Hand
Joined: Jun 21, 2006
Posts: 96
posted
0
Hi
I am not getting any error.
can you please tell me where are you getting the error.
Thanks
Stary Kapec
Ranch Hand
Joined: Dec 04, 2005
Posts: 81
posted
0
Hi,
Try to instantiate the class. Add the main method.
wise owen
Ranch Hand
Joined: Feb 02, 2006
Posts: 2023
posted
0
You can fix the problem by adding "static" modifier
[ August 16, 2006: Message edited by: wise owen ]
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
posted
0
This is a duplicate, with the same answer. Parameswaran, please don't post the same question in more than one forum here; it just wastes people's time when they respond to it without knowing it's already been answered elsewhere.