SHARE
TWEET

Untitled

a guest Oct 12th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Main {
  2.  
  3.     public static void main(String[] args) {
  4.         MyThread my = new MyThread();
  5.         Thread thread1 = new Thread(new Runnable() {
  6.             @Override
  7.             public void run() {
  8.                 my.f();
  9.             }
  10.         });
  11.         Thread thread2 = new Thread(new Runnable() {
  12.             @Override
  13.             public void run() {
  14.                 for (int i = 0; i < 100; i++) {
  15.                     my.test(i);
  16.                 }
  17.             }
  18.         });
  19.         Thread thread3 = new Thread(new Runnable() {
  20.             @Override
  21.             public void run() {
  22.                 my.f();
  23.             }
  24.         });
  25.         thread1.start();
  26.         thread3.start();
  27.         thread2.start();
  28.  
  29.     }
  30.  
  31.  
  32. }
RAW Paste Data
Top