4
Contributors
7
Replies
36
Views
3 Years
Discussion Span
Last Post by JamesCherrill
Featured Replies
  • You can sleep the current thread by using Thread's sleep method http://docs.oracle.com/javase/6/docs/api/java/lang/Thread.html#sleep%28long%29 ps: I assume you know that your constructor will loop recursively until you run out of memory? Read More

  • I think you should try to compile and execute that code before assuming you have finished! Read More

0

Sorry - my fault. It was originally posted as a code snippet, I changed it to a Discussion, and the code vanished. But basically it went

class A {
   A() {
      ...
      new A();
   }

ps Sorry akhilchandranms, if you would like to post the code again that would be great.
J

0

@JamesCherrill
Thanku sir i got it

class A{
static int a=0;
i++;
Thread.sleep(1000);
A(){
new A();

}
}
0

there are other methods also wait notify notify all etc use that too....

0

nira: Are you suggesting that OP should use wait notify notify all etc to meet his requirement of "make the system wait for some period of time".
Please make sure your answers really do relate to the OP's actual need.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.