Topics Index

Madam Name

If you need explanation Read this topic

If you need Answer Take test on this topic

Madam Name
What will be the output of the following program?
public class Madam extends Thread {
    Madam() {
    public void run() {
    public static void main(String[] args) {
        Madam m = new Madam();
        System.out.println("Thread alive? " + Thread.currentThread().isAlive());

A. Thread alive? false
B. Thread alive? true
C. Thread alive? true
D. Some other output
E. Output can not be determined
F. Compilation Error or Runtime Error
Topic: What is Multitasking and Multithreading?

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans is A.

Posted by Gopinath Manchikanti    2014-04-02 08:57:17

Answer is B : since vn in currntthread the isalive is called it returns true since the currentThread is alive..!! then when start is set the name as gowthami as mentioned ! and the priority as 10 since it is given the maxprior..!!

Posted by Shaik Nyamath    2014-04-02 08:58:10

Ans is B.. thread isAlive method is true, and then start vl gets executed and we setting thread name to Gowthami and keeping its priority as max i.e., 10

Posted by Om Prakash Om    2014-04-02 09:49:23

and: b
firstly thread is create and name set to "gowthami" and priority set to Max _priority...
here that thread is not started... bt main thread is alive so true....
thread alive ? true printed
and then m thread cals start it initiate the run function now m thread is alive and became current thread ..
thread[gowthami ,10,main] is printed

Posted by Ananda Kumar    2014-04-02 09:49:30

Congratulations Om Prakash Om. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-04-03 04:35:39

© meritcampus 2019

All Rights Reserved.

Open In App