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.
Java
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback