Menu
Question Index
...

What will be the output of the following program?

public class OutputOfThread extends Thread {
    private OutputOfThread() {
        setPriority(NORM_PRIORITY);
        setPriority(MAX_PRIORITY);
        setPriority(MIN_PRIORITY);
    }
    public void run() {
        System.out.print("Run = ");
        System.out.println(Thread.currentThread().getPriority() + Thread.currentThread().getPriority());
    }
    public static void main(String[] args) {
        OutputOfThread oft = new OutputOfThread();
        System.out.print("Main = ");
        System.out.println(Thread.MAX_PRIORITY + Thread.MIN_PRIORITY + Thread.NORM_PRIORITY);
        oft.start();
    }
}


Main = 16
Run = 2
Main = 1015
Run = 11
Some other output
Output can not be determined
Compilation Error or Runtime Error

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