the problem about Thread

From: aleel (
Date: 04/25/04

Date: 24 Apr 2004 22:00:27 -0700

I am a beginner .Thank for your help !
    I constructed three classes ManyThreadsTest,Timer and
Calculator.class Timer and Calculator implements the Runable interface
,class ManyThreadsTest
includes two static variables t1 and t2,then in the static field of
ManyThreadsTest announces :
   static {
  t1=new Thread (new Timer());
  t2 =new Thread (new Calculator());
  then in the main function as follows :
  public static void main(String[] args) {

     t1 = new Thread(new Timer());
     t2 = new Thread(new Calculator());
    try {
    catch (InterruptedException ex) {
  and the run function of the Calculator as follows :
     public void run() {

    for (int i = 0; i <= 5000; i++) {
      String str = "a prime number!";
      if (isPrimeNum(i)) {
        System.out.println(i + " is " + str);
      else {
        System.out.println(i + " is not " + str);
                char c;
                try {
                        c = (char);
                } catch (IOException e) {
    the class Timer is used to record time , and the class Calculator
is used to judge a number which is lower than 10000 is a prime number
or not ,I want to break the Thread t1(used to record time )after the
Calculator finished its work .so I writed
"ManyThreadsTest.t1.destroy();" in the run function of Calculator
class .however, I found the Thread t1 continued after the destroy ()be
executed ,and the screen showed the time at all times.I wanted
originally to input the char "q" to make the program leave .but I
cannot do so now .how to solve the problem ?