ThreadDemo2908 - Java Quiz Question


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());
    }
}


A
Before Priority = 0
After Priority = 5
Thread Question
B
Before Priority = 5
After Priority = 5
Thread Question
C
Before Priority = 1
After Priority = 5
Thread Question
E
Compilation Error or Runtime Error