Menu
Topics Index
...
`

Class Implementing Runnable interface


If you need explanation Read this topic

If you need Answer Take test on this topic

Class Implementing Runnable interface
What will be the output of the following program?
class RunnableTest extends java.util.Vector implements Runnable { // LINE A
    public void run() { // LINE C
        System.out.println("Run Method");
    }
}
public class Test {
    public static void main(String[] args) {
        Runnable obj = new RunnableTest(); // LINE D
        Thread t = new Thread(obj); // LINE B
        t.start();
    }
}

A. Run Method
B. Compile time Error at LINE A
C. Compile Error at LINE B because we can not pass parameter to Thread
D. Compile time Error at LINE C
E. Run time Error at LINE D
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.

Answer is A as new thread starts and goes to run() and prints Run Method

Posted by Vinod Kumar M    2013-08-07 03:56:00


e

Posted by Prasanth Hero    2013-08-07 05:02:16


B

Posted by Prudhvini Putta    2013-08-07 07:31:32


A

Posted by Preethi Bitukunti    2013-08-07 11:39:25


B because packages are used as extends

Posted by Sreenath Vallapaneni    2013-08-07 13:06:42


c

Posted by Aruna Dantu    2013-08-07 13:56:04


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

Posted by Merit Campus    2013-08-08 03:25:00


© meritcampus 2019

All Rights Reserved.

Open In App