• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Threads

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
In the Following Question,
I think options 1,3 are correct.but the answer they have given is 1,2,3.But In option2 we can't guarantee that behavior.Please correct me if iam wrong.



What can cause a thread to stop executing?

1) The program exits via a call to System.exit(0);
2) Another thread is given a higher priority
3) A call to the thread's stop method.
4) A call to the halt method of the Thread class?
 
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
System.exit(1) will stop whole jvm so there is no doubt abt it for stopping thread
If Another thread is given a higher priority there is no guarantee that thread will stop and
New thread will run. Because different jvm, s has different priority.
thread's stop method has been Deprecated and is not in use.
There is no halt method in Thread class.

Now Question is asking for �what can stop� not �What will stop�
So answer is 1,2,3
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This mock exam. question seems to be quite old and out of date. It is probably for Java 1.2 or earlier. Why? Because it mentions method stop() which has been deprecated because it was found to cause problems in programs using it. Same goes for method suspend() if you see it.
 
Sireesha Mullapudi
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

where i can get scjp1.4(with modifications,bcos there is no awt&io) mock tests.

Thanks
 
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go SCJFAQ in Javaranch.
 
reply
    Bookmark Topic Watch Topic
  • New Topic