Menu
Topics Index
...
`

Class Implementing Runnable interface1683


If you need explanation Read this topic

If you need Answer Take test on this topic

Class Implementing Runnable interface1683
What is the output of the following program?
public class Locks implements Runnable {
    public void run() {
        int i = 0;;
        while (i < 2) {
            System.out.print("Hai");
            i++;
        }
    }
    public static void main(String... h) {
        Locks locks = new Locks();
        locks.start();
    }
}

A. HaiHai
B. Executes without any output
C. Compilation Error
D. 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.

c...since locks implements Runnable , and to act object of locks as thread...u should send locks object to a thread object.

Posted by Sulekha Metta    2013-08-13 03:52:18


C is the correct answer because there is no start() method in Locks class or in its super classes hence compile time error

Posted by Ram Reddy Bitla    2013-08-13 04:25:07


Congratulations Sulekha Metta. You are this dose winner. Please send us your mobile details and we will process the recharge asap.

Posted by Merit Campus    2013-08-14 04:00:21


thanks..received rc

Posted by Sulekha Metta    2013-08-18 12:06:21


© meritcampus 2019

All Rights Reserved.

Open In App