The order of lines

Report a typo

Here's a class that extends Thread and overrides the run method:

class MyThread extends Thread {

    @Override
    public void run() {
        System.out.println("Hello from " + getName());
    }
}


And a snippet of code:

MyThread t1 = new MyThread();
t1.setName("My-thread-1");
t1.start();

t1.join();

MyThread t2 = new MyThread();
t2.setName("My-thread-2");
t2.start();
        
System.out.println("output-1");
        
t2.join();
        
System.out.println("output-2");

In what order may the strings be printed out? Select all possible cases.

Select one or more options from the list
___

Create a free account to access the full topic