Menu
Question Index
...

What will be the output of the following program?

public class Digital extends Thread {

    public void run() {
        System.out.println("Now you are here");
    }

    public static void main(String a[]) {
        Thread run = new Thread(new Digital());
        System.out.print("1. ");
        run.start();
        System.out.print("2. ");
        run.start();
    }
}


1. Now you are here
2. Now you are here
1. Now you are here
Compilation Error
Throws java.lang.IllegalThreadStateException
Runtime Error for some other reason

Doubts

Problems

Topic: What is Multitasking and Multithreading?

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App