Exemple #1
1
 public static void main(String[] args) {
   MyThread mt = new MyThread();
   Thread t1 = new Thread(mt, "AAAA");
   Thread t2 = new Thread(mt, "BBBB");
   Thread t3 = new Thread(mt, "CCCC");
   t1.setPriority(Thread.MAX_PRIORITY);
   t2.setPriority(Thread.NORM_PRIORITY);
   t3.setPriority(Thread.MIN_PRIORITY);
   t1.start();
   t2.start();
   t3.start();
   mt.run();
 }
Exemple #2
0
 public static void main(String[] args) {
   MyThread mt = new MyThread();
   Thread t = new Thread(mt, "Join");
   t.start();
   try {
     t.join();
     mt.run();
     // t.join();
   } catch (Exception e) {
   }
 }
Exemple #3
0
 public static void main(String[] args) {
   MyThread mt = new MyThread();
   Thread t = new Thread(mt, "interrupt");
   t.start();
   try {
     Thread.sleep(12);
   } catch (Exception e) {
   }
   t.interrupt();
   mt.run();
 }
Exemple #4
0
 public void run() {
   MyThread t = new MyThread();
   t.run();
 }
Exemple #5
0
 public static void main(String[] args) {
   MyThread mt = new MyThread();
   new Thread(mt, "QQ").start();
   mt.run();
 }