SCJP Module-8 Question-5


 

SCJP Module-8 Question-5

The program given below will test your understanding of Thread execution and thread class in Java.

The program given below will test your understanding of Thread execution and thread class in Java.

Given a sample code:

1    public class Test4 extends Thread{
2    public static void main(String args[]){
3    Test4 b = new Test4();
4    b.run();
5    }
6    public void start(){
7    System.out.println("start");
8    }}

Which of the following statement is correct ?

(A) Print start.
(B) Compiled successfully but no result.
(C) Raise Runtime exception.
(D) Compilation error at line no 4.

Answer:

(B)

Ads