Menu
Question Index
...

What will be the output of the following program?

public class ThreadQuestion {
    public static void main(String[] args) {
        Thread t = new Thread();
        System.out.println("Before Priority = " + t.getPriority());
        t.setPriority(5);
        System.out.println("After Priority = " + t.getPriority());
        t.setName("Thread Question");
        System.out.println(t.getName());
    }
}


Before Priority = 0
After Priority = 5
Thread Question
Before Priority = 5
After Priority = 5
Thread Question
Before Priority = 1
After Priority = 5
Thread Question
Compilation Error or Runtime Error

Doubts

Problems

Topic: Thread Concept In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App