Share on Google+Share on Google+

SCJP Module-8 Question-5

Advertisement
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)

Advertisements

Posted on: July 15, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.