aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Threads Question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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: 6588
    
    1

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


SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
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
Bartender

Joined: Aug 16, 2005
Posts: 12928
    
    3

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 7 API documentation
Scala Notes - My blog about Scala
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
 
Similar Threads
Help in a question about Threads
Thread question from www.scjptest.com
Concurrency question
thread problem