//OUTPUT System.out.println("the value for a="+ good.a );
System.out.println("the value for new1="+ new1 ); System.out.println("the value for new2="+ new2 ); System.out.println("the value for Local="+ good ); good.main("hello");
If your entire program looks exactly as in your first post, it will stop after running for some time with either a StackOverflowError or an OutOfMemoryError, because there's an unbounded recursive call in it: you call the main() method from the main() method itself. It will keep calling itself over and over again until the stack overflows or you have created so many LocalMain objects that the memory is exhausted.
Just tried to compile and run your program: I got a StackOverflowError. [ December 07, 2005: Message edited by: Jesper de Jong ]
As Jesper said, you name does not conform to our naming policy. It's one of the few rules we have around here, and we take it pretty seriously. Basically, you need a first name, a space, and a last name. No obviously ficticious names are allowed, either.
We're happy you're here, and are delighted to answer your questions. Many of us came here for the help, and stayed for the community. Hope you do the same!!!
Never ascribe to malice that which can be adequately explained by stupidity.
Nipun Devlekar
Greenhorn
Joined: Dec 07, 2005
Posts: 9
posted
0
Thanks for your replies i did not get a stack error but a continuous running screen . As i am using a unix OS i did not get error;may be stack error reports in DOS .
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
Originally posted by Nipun Devlekar: Thanks for your replies i did not get a stack error but a continuous running screen .
Is that what you referred to earlier as "the code executed smoothly"
Originally posted by Nipun Devlekar: Thanks for your replies i did not get a stack error but a continuous running screen . As i am using a unix OS i did not get error;may be stack error reports in DOS .
You'll just have to wait a bit longer for the stack overflow...
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Why cant i call main method from another class having main block