what is the difference between sleep() and Wait()?
Answer Posted / modi[achir communication pvt.
Wait() : This function takes parameters as milliseconds and
puts the thread in wait state for the desired time of the
programmer after time passes the execution starts again.
Sleep() : This function is also used for same purpose using
his function by java you can put a thread in sleep state
.sleep does not contains any parameters so the thread will
not be automatically start execution It needs a wake up
signal again which can be Notify().or other function are
also provided by java.
So the main difference in Wait() and sleep() is wait takes
time parameter and wait for specific time only and sleep
throws a thread in sleep mode for unspecified time.
| Is This Answer Correct ? | 6 Yes | 105 No |
Post New Answer View All Answers
What is default locale java?
Can you declare the main method as final?
What is the default value of local and global variables?
How many bits is a float?
What are the advantages of autoboxing?
Explain throw keyword in java?
What is a line break?
How to invoke external process in java.
Can we define private and protected modifiers for the members in interfaces?
Write a java program to find the route that connects between Red and Green Cells. General Rules for traversal 1. You can traverse from one cell to another vertically, horizontally or diagonally. 2. You cannot traverse through Black cells. 3. There should be only one Red and Green cell and at least one of each should be present. Otherwise the array is invalid. 4. You cannot revisit a cell that you have already traversed. 5. The maze need not be in the same as given in the above example
What is the difference between overriding and overloading in OOPS.
Justify your answer that you can't define a method inside another method in java, if you can then how?
what do you understand by the term string with respect to java?
What is substring in java?
Is singleton thread safe in java?