What happens at compile-time and running this code?

class MyThread extends Thread {
    public void run() {
        System.out.print("Running ");
    public void start() {
        System.out.print("Starting ");

public class Q202 {
    public static void main(String[] args) {
        MyThread t = new MyThread();
When you run the stream start() method the run() method is called of this stream. Since the start() method is overridden and there wasn't an explicit call to run() method, therefore nothing else will be performed.

Follow CodeGalaxy

Mobile Beta

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