• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Thread Question from JQ+

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i m agree with u Jim Hall
rgds
vishal
 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rodney is right...
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic