|
-
Mar 16th, 2008, 10:52 PM
#1
Thread Starter
PowerPoster
[RESOLVED] Unable to stop/suspend the thread.
Hi all,
I have use a Thread just to print some numbers as follows.
Code:
Thread tempTH = new Thread(new Runnable() {
public void run(){
int counter = 1;
while(counter != 0){ // Condition to change
try {
System.out.println(counter++);
Thread.sleep(1000);
}
catch (InterruptedException ex){
System.out.println(ex);
}
}
tempTH.start();
}
});
I want to stop this thread, and try to following
Actually I can;'t do that. stop() is not allowed to use. As you know in my IDE simply draw a line across the word stop() and notify that I can't do it.
Why is that, any idea.
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|