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

Code:
tempTH.stop();
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.