Explain java thread sleep method java interview question and answer

Опубликовано: 20 Октябрь 2012
на канале: Interview DOT
1,272
0

Click here -    / @interviewdot   to get notifications. JOB VACANCIES IN TOP IT / NOT-IT COMPANIES

UPLOAD YOUR RESUME IN 1 MINUTE ! ! !
http://www.interviewdot.com/upload-re...

http://www.interviewdot.com http://www.interviewdot.com http://www.interviewdot.com

Welcome to www.InterviewDot.com How to for prepare for Interview Questions : Interview Questions and Answers.

Explain Java thread's sleep() method ? Java Interview Question and Answers.

Explain java thread's sleep() method ?

Sleep method is a static method of a class thread.
It is used to slow down the thread ie moving away from runnable state for configured milliseconds.
To force the thread to move away from runnable state ,sleep method is used.

Example :

Public static void main(String[] args){
try{
Thread.sleep(5*60*1000) // sleep for 5 minutes.
}catch(InterruptedException ex){
print("exception happened");
}
}

When does Java's Thread.sleep throw InterruptedException ? Java Interview

Thrown when a thread is waiting, sleeping, or otherwise paused for a long time and another thread interrupts it using the interrupt method in class Thread


For more Java Interview questions and answers - logon to www.InterviewDot.com - India's Top Interview Guide.

http://www.interviewdot.com http://www.interviewdot.com http://www.interviewdot.com


На этой странице сайта вы можете посмотреть видео онлайн Explain java thread sleep method java interview question and answer длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Interview DOT 20 Октябрь 2012, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,272 раз и оно понравилось 0 зрителям. Приятного просмотра!