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(); }
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) { } }
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(); }
public void run() { MyThread t = new MyThread(); t.run(); }
public static void main(String[] args) { MyThread mt = new MyThread(); new Thread(mt, "QQ").start(); mt.run(); }