Select the only true option of compilation and running the code.

public class MyThread extends Thread {
    public static void main(String[] args) {
        new MyThread().start();
    }
}
Explanation
Starting a new thread executes the code that is located in the method run(). MyThread class inherits from the Thread class the empty method run() - so a new thread will bring nothing and just completes its work, and after the whole application will finish its work.

Follow CodeGalaxy

Mobile Beta

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