public class MyThread implements Runnable {
public void run() {
System.out.println("hello");
try {
Thread.sleep(Math.round(200 * Math.random()));
} catch (InterruptedException e) { }
System.out.println("world");
}
public static void main(String[] args) {
new Thread(new MyThread()).run();
new Thread(new MyThread()).run();
}
}
Login in to like
Login in to comment