Q: Analyze the following code:
public class Test implements Runnable{
public static void main(String[] args){
Test t = new Test();
t.start();
}
public void run() { }
}
-
A
The program does not compile because the start() method is not defined in the Test class.
-
B
The program compiles, but it does not run because the start() method is not defined.
-
C
The program compiles, but it does not run because the run() method is not implemented.
-
D
The program compiles and runs fine.
A
Answer:
A
Explanation:
The program does not compile because the start() method is not defined in the Test class.
Related Topic:
Share Above MCQ