aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Threads Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Threads Question " Watch "Threads Question " New topic
Author

Threads Question

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

scjptest.com




A) Compilation fails.
B) An exception is thrown at runtime.
C) "go" is printed
D) "gogogo" is printed
E) "gogo" is printed
Answer: D

i think output should be c) as t.run() would call run method of Thread class


OCPJP 6.0 93%
OCPJWCD 5.0 98%
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Did you run this ? What is the difference between the run() and start() methods ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

we have not defined any run method for thread class.so
t.run();
would do nothing
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14430
    
  23

Where did you copy this question from? Please remember that you are required to QuoteYourSources on JavaRanch whenever you copy a question from a book, mock exam or other source.

What do you mean with "from SCJP TEST"? Is this from the real, actual exam? Are you aware that you are not allowed to copy the content of the real exam?

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Trivikram Kamat
Ranch Hand

Joined: Sep 26, 2010
Posts: 155
mohitkumar gupta wrote:
think output should be c) as t.run() would call run method of Thread class


If the Thread whose run() method is called was constructed using separate Runnable object, then that Runnable object's run method is called. Otherwise, method does nothing and returns. (from Javadocs)


OCPJP6
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Threads Question