• 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 ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

q on threads

Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have an application that executes the following line:

Thread myT = new Thread();

Which statements are correct? [Check all correct answers]

The Thread myT is now in a runnable state.

The Thread myT has the priority of the Thread that executed the construction statement.

If myT.start() is called, the run method in the class where the construction statement appears will be executed.

If myT.stop() is called, the Thread can later be started with myT.start() and will execute the run method in the Thread class.

which are the correct options and y?
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jayasiji Gopal,

I feel only the second statement is correct as, a thread inherits the priority of the parent thread.

First is false because, only when a myT.start() is called a thread enters the Runnable state. Till then, it is just a live object.

Third is false because the default "run" of the Thread class will be called.

Fourth, I am not very sure, but since stop() is deprecated, you will not get questions pertaining to stop in your SCJP1.4.

Expecting answers and demures. Thanks!

Last but not the least! As always pointed out by Barry, please always mention the link from which you get the question that you publish for us.
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic