The moose likes Threads and Synchronization and the fly likes plz i need ans to the following questions Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "plz i need ans to the following questions" Watch "plz i need ans to the following questions" New topic
Author

plz i need ans to the following questions

tania khan
Greenhorn

Joined: Feb 05, 2002
Posts: 2
i have few questions. i would be thankful if anyone ans my questions
my first question is
Q WHICH OF THE FOLLOWING THREADS WILL MOST LIKELY TO RUN FIRST?
a- a finished thread with priority of MAX-PRIORITY.
b- a runable thread with priority of 1
c- a runnable thread with priority of 2
d- suspended thread with priority of 5
plz define the term " runnable" precisely. i think here it means the thread which is in ready to run position" am i right?
my second question is :-
Q WHICH OF THE FOLLOWING IS NOT A VALID STATE OF THREAD?
a dead
b running
c runnable
d altered
my third question is :-
Q CAN INHERITED SYNCHRONIZED METHOD HAVE ITS MODIFIER CHANGED IN THE SUBCLASS ?
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
plz define the term " runnable" precisely. i think here it means the thread which is in ready to run position" am i right?

Yes.
Q WHICH OF THE FOLLOWING THREADS WILL MOST LIKELY TO RUN FIRST?
a- a finished thread with priority of MAX-PRIORITY.
b- a runable thread with priority of 1
c- a runnable thread with priority of 2
d- suspended thread with priority of 5

If by a finished thread you mean a thread that has completed execution of its run() method then it's, uh, out of the running. A supended thread will not become runnable again unless it is revived with resume(). So you are left with b and c. Whoever runs first is really at the mercy of the thread scheduler, which is implementation-dependent. But since we are talking about likelihood instead of certainties, I'll place my bet on c.
my second question is :-
Q WHICH OF THE FOLLOWING IS NOT A VALID STATE OF THREAD?
a dead
b running
c runnable
d altered

What on earth is altered?
my third question is :-
Q CAN INHERITED SYNCHRONIZED METHOD HAVE ITS MODIFIER CHANGED IN THE SUBCLASS

A method that overrides a synchronized method may or may not be synchronized.
-anthony
[ April 01, 2002: Message edited by: Anthony Villanueva ]
 
 
subject: plz i need ans to the following questions
 
Threads others viewed
Thread question?
Methods belong to Thread class???
Garbage Collection and Threads
Thread Question
thread question from java cram
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture