Select the correct answerIn the following java program, what is the NAME of the thread?class Nptel extends Thread{ public static void main(String args[]) { Thread t = Thread.currentThread(); System.out.println(t); }}OptionsmainthreadsystemNone of these
Question
Select the correct answerIn the following java program, what is the NAME of the thread?class Nptel extends Thread{ public static void main(String args[]) { Thread t = Thread.currentThread(); System.out.println(t); }}OptionsmainthreadsystemNone of these
Solution
The correct answer is "main". In the given Java program, the current thread is being fetched using Thread.currentThread() and it is being printed. By default, the main thread is the one that starts when a Java application starts.
Similar Questions
Select the correct answerWhat is the name of the thread in the following Java Program?class CT{ public static void main(String args[]) { Thread s = Thread.currentThread(); System.out.println(s); }}OptionsmainSystemNone of the mentionedThread
What is the name of the thread in the following Java Program?class multithreaded_programing{public static void main(String args[]) { Thread t = Thread.currentThread(); System.out.println(t); }}mainThreadSystemNone of the mentioned
Select the correct answerWhat is the name of the thread in output in the following Java program?class Main{ public static void main(String args[]) { Thread t = Thread.currentThread(); System.out.println(t.getPriority()); }}Options4105
Select the correct answerWhat is the name of the priority of this Thread in this program?class Nptel extends Thread{ public static void main(String args[]) { Thread t = Thread.currentThread(); System.out.println(t.getPriority()); }}Options1054
elect the correct answerWhat will be the output of the following Java code?class Main{ public static void main(String args[]) { Thread t = Thread.currentThread(); t.setName("New Thread"); System.out.println(t); }}OptionsThread[main,5,main]Thread[New Thread,5]Thread[5,main]Thread[New Thread,5,main]
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.