Which is the result of compiling and running the following code:

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();
    }
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes