What is the result of the following code execution?

public class TestThread extends Thread { 
    public void run() { System.out.println( "Run!" ); } 
    public void begin() { System.out.println( "Begin!" ); } 
    public void execute() { System.out.println( "Execute!" ); } 

    public static void main( String[] args ) { 
        TestThread myTest = new TestThread(); 
        myTest.start(); 
    } 
}
Explanation
Run! is the correct answer since run() method is executed when thread is started after start() method is called.

Follow CodeGalaxy

Mobile Beta

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