aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread Question from JQ+ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread Question from JQ+" Watch "Thread Question from JQ+" New topic
Author

Thread Question from JQ+

Jim Hall
Ranch Hand

Joined: Nov 29, 2001
Posts: 162
Which of the following statements are true?
Select only one:
(a) To provide threading behaviour a class must extend Thread class.
(b) To provide threading behaviour a class must implement Runnable interface.
(c) Threads created by user are always non-daemon threads.
(d)Thread created internally by the JVM are always daemon threads.
(e) None of the above are correct.
I answered (b). JQ+ answer is (e).
Don't all classes that provide threading behavior implement the Runnable interface. Since the Thread class implements Runnable, isn't it correct to say the above.
[This message has been edited by Jim Hall (edited December 03, 2001).]
vishal avad
Ranch Hand

Joined: Nov 29, 2001
Posts: 45
hi
i m agree with u Jim Hall
rgds
vishal
Rowan Brownlee
Ranch Hand

Joined: Aug 07, 2000
Posts: 97
Hi Jim,
This sounds odd. I wonder what JQ+ means by threading behaviour. eg. you might write a class (containing main) that doesn't explicitly implement Runnable, or extend Thread. However, main will execute in a thread. Would JQ+ argue that this is a provision of threading behaviour, so justifying a negative on (b)??
cheerio
rowan
Originally posted by Jim Hall:
Which of the following statements are true?
Select only one:
(a) To provide threading behaviour a class must extend Thread class.
(b) To provide threading behaviour a class must implement Runnable interface.
(c) Threads created by user are always non-daemon threads.
(d)Thread created internally by the JVM are always daemon threads.
(e) None of the above are correct.
I answered (b). JQ+ answer is (e).
Don't all classes that provide threading behavior implement the Runnable interface. Since the Thread class implements Runnable, isn't it correct to say the above.
[This message has been edited by Jim Hall (edited December 03, 2001).]

Jim Hall
Ranch Hand

Joined: Nov 29, 2001
Posts: 162
JQ+'s explanation says that it should be (a) and (b). That is why the answer is (e).
But can (b) be true by itself, since Thread implements Runnable.
farrukh mahmud
Ranch Hand

Joined: Feb 13, 2001
Posts: 47

Select only one:
(a) To provide threading behaviour a class must extend Thread class.
(b) To provide threading behaviour a class must implement Runnable interface.
(c) Threads created by user are always non-daemon threads.
(d)Thread created internally by the JVM are always daemon threads.
(e) None of the above are correct.

well first two options are correct if user want to create thread but third false and fourth true but we have to select one ans which is e
correct me if i am wrong

------------------
Regards
Farrukh Mahmud


Regards<BR>Farrukh Mahmud
Rodney Woodruff
Ranch Hand

Joined: Dec 04, 2001
Posts: 80
The answer lies in the wording of both a, b. d and c are false.
(a) says : To provide threading behaviour a class must extend Thread class.
Likewise (b) says To provide threading behaviour a class must implement Runnable interface.
Because both answers a and b use the word must, they are both false. These answers would be true if they said something like: To provide threading behaviour a class can either implement the Runnable interface or extend the Thread class (You could also get the behaviour by extending a class that extends the Thread class)
Therefore answers a - d would be incorrect and consequently the only correct answer is e: None of the Above are correct.
I hope this helps.

[This message has been edited by Rodney Woodruff (edited December 04, 2001).]


Hope This Helps
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
I agree with Rodney. BEWARE OF THE WORDING. Every word is important !!! Here we talk about "MUST" and since only one answer is accepted, clearly a and b are not correct !! e is correct.
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
angel canales
Greenhorn

Joined: Dec 04, 2001
Posts: 1
Rodney is right...
Hussain
Ranch Hand

Joined: Nov 22, 2001
Posts: 110
all of u read the Question carefully as it says on option b.....
b:tht it must implements Runnable..
but tht is not the case a threading Behaviour can Be provide by extending Thread as well.
Understand.
Jq+ is rite..

Muhammad Hussain<br />Sun Certified Java Programer (SCJP2)<br />Sun Certified Web Component Devloper SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread Question from JQ+