What is the name of the thread in output in the following Java program? [code] class multithreaded_programing { public

Phạm Quyết

New member
What is the name of the thread in output in the following Java program?
Code:
    class multithreaded_programing
    {
        public static void main(String args[])
        {
            Thread t = Thread.currentThread();
            System.out.println(t.isAlive());        
        }
    }
A. 0
B. 1
C. true
D. false
 
Answer: c
Explanation: Thread t is seeded to currently program, hence when you run the program the thread becomes active & code ‘t.isAlive’ returns true.
Output:
Code:
$ javac multithreaded_programing.java
$ java multithreaded_programing
true
This section of our 1000+ Java MCQs focuses on throw, throws & nested try of Java Programming Language.
 

Tìm kiếm

Back
Top