java questions

java questions

what is the difference between wait() and sleep() methods in thread class?

View Answers

January 12, 2011 at 4:21 PM

Hi Friend,

1) wait()is a Object class method whereas sleep() is a thread class method.

2)The sleep method sends the current thread into Non-Runnable state for the specified amount of time but it doesn't cause the thread to loose ownership of the acquired monitors.The wait() method also sends the current thread into Non-Runnable state like the sleep() method but wait() method, the locks are released before going into Non-Runnable state, so that any other thread that is waiting on the object can use it.

3)Sleep method will not release the lock after completion of time but wait method does.

For more information, visit the following links:

Wait Method

Sleep Method

Thanks

Thanks









Related Tutorials/Questions & Answers:
Java - Java Interview Questions
Java  Questions on Java
java questions - Java Interview Questions
java questions  HI ALL , how are all of u?? Plz send me the paths of java core questions and answers pdfs or interview questions pdfs or ebooks :) please favor me best books of interviews questions for craking
Advertisements
java - Java Interview Questions
Helpful Java Interview questions   Need Helpful Java Interview questions
JAVA QUESTIONS - Java Beginners
java questions asked in interview oracle  Hi all, Does anyone have a list of Java questions that is generally asked in Interview at Oracle
interview questions - Java Interview Questions
interview questions for Java  Hi Any one can u please post the interview point of questions.Warm Regards, Satish
interview - Java Interview Questions
interview  kindly guide me some interview questions of Java
Java Interview Questions
Java Interview Questions  Hi, Can anyone tell the urls of Java Interview Questions on roseindia.net? Thanks
jvm - Java Interview Questions
jvm  Can you provide some JVM Questions for Java Interview preparation
Struts - Java Interview Questions
Struts Interview Questions  I need Java Struts Interview Questions and examples
help me - Java Interview Questions
interview questions java pdf   Do you have any PDF for Java Interview questions
Questions about Java's String pool
Questions about Java's String pool  Questions about Java's String pool
java questions
java questions  why java is not open source
java questions
java questions  why java is not open source
java questions
java questions  can i write an inner class in an interface
java questions
java questions  what is the proper way of code our program?   Have a look at the following link: Core Java Tutorials
Java Questions
Java Questions   How to dispaly my databsae records in my jsp page using collections My java class   Visit Here
Java Questions
Java Questions   How to dispaly my databsae records in my jsp page using collections My java class   Visit Here
java questions
java questions  what is the difference between wait() and sleep() methods in thread class
java questions
java questions  how is java platform independent? is jsp thread safe... (known as the Platform independent) is one of the important key feature of java language that makes java as the most powerful language. When Java Code
java Questions
java Questions  do we need to implement all methods interface if yes I want example code please send me
Java Questions
Java Questions  How can I set classpath for java classes through java.... There no general use of setting class path from the Java program.ADS... in Java class. Unless you are developing the applications like tomcat you really
java certification questions - Java Beginners
java certification questions  i need java certification questions
java - Java Interview Questions
Java Development  I need a Job in Java Development..so preparing for it. Can anyone please guide me how to prepare and what are the common questions that can be asked at interview
Interview Questions - What is Java?
Interview Questions - What is Java?  What is Java?   Hi, Java is high level programming langue developed by James Gosling. Now Java.... Check in detail at: What is Java? View all Java Interview Questions
java - Java Interview Questions
questins in java .wat normally v see in interviews (tech apptitude)is one line... simple 2 answer..but it becomes complicated wen v see questions in jumbled form... ...or any of the sites....which handles these kind of questions...   Hi
Java - Java Interview Questions
://www.roseindia.net/java/example/java/util/HashTable.shtml Thank you for posting questions. Rose India Team
JAVA - Java Interview Questions
JAVA  i need objective Questions and answers ( with 4 or 5 choice) in JAVA. Can anyone help me?   H1!! pl. mail your email id to [email protected]. I will send you within 2-3 days. Krishna
hint - Java Interview Questions
hint  Dear roseindia, i want the java interview question and the corresponding question answers.   Hi Friend, Please visit... of interview questions and their answers. Thanks  thanks for your
java - Servlet Interview Questions
Java Design Patterns Interview Questions and Answers  I need to know Java Design Patterns with the help of Interview Questions and Answers  Hi malli,GenericServlet is the super class of HttpServlet calssjava soft
java interview - JSP-Interview Questions
java interview  what type of questions would be asked to a 3 years experience person in java? can anyone please provide list of topics or interview questions for 3 years experience in java
java - Java Interview Questions
Java interview questions and answers for freshers  Please provide me the link of Java interview questions and answers for freshers  Hi friend,class Point{ int x, y; Point(){ System.out.println("default"
Java Questions & Java FAQ
Java Questions & Java FAQ  ... have listed the Java Questions which are commonly asked. Our collection... are the list of those Java Questions and FAQs. Question: It is said that the code
Interview Questions - Where Java is used?
Interview Questions - Where Java is used?  Hello, Where Java is used? Thanks   Hi, Java is used for creating various types... being Used?. View all interview questions at Java Interview Questions with Answers
java - Servlet Interview Questions
java  servlet interview questions  Hi friend, For Servlet interview Questions visit to : http://www.roseindia.net/interviewquestions/servlet/ Thanks
java - Java Interview Questions
java  i want to java&j2ee interview questions. Regards Akhilesh Kumar  Hi friend, I am sending you a link. This link will help you. Read for more information. http://www.roseindia.net/interviewquestions
Interview Questions - How Java is Used?
Interview Questions - How Java is Used?  Hi, How Java is Used... For Creating Applets Check: Where is Java being Used? View all interview questions at Java Interview Questions with Answers page. Thanks
Java interview questions and answers
Java interview questions and answers   what is garbage collection? What is the process that is responsible for doing that in java? Ans.Reclaiming... in Java? Ans. Runtime.getRuntime().exec(â?¦.) 5.What is the basic difference
java - JSP-Interview Questions
. These are all fairly fundamental questions, try purchasing any introduction to Java...java  whats meant by the following terms as applied in java:- 1.object oriented programming. 2.void 3.private 4.protected thanks homey.  
Questions in Swing - Java Beginners
Questions in Swing  I have created combobox in my program. I added MCA,MBA,others etc.. If i click others then a new textbox should open beside that combobox for that am in need of coding in java swing.  Hi Friend
Core Java Interview questions and answers
Core Java Interview questions and answers  .... So, we have tried to create most frequently asked Core Java Interview Questions and answers in one place.ADS_TO_REPLACE_1 These Core Java Interview Questions
Java interview questions
Java interview questions  Plz answer the following questions..... The type long can be used to store values in the following range: a. -263 to 263 - 1 b. -231 to 231 - 1 c. -264 to 264 d. -232 to 232 - 1 Which
java servlets - Servlet Interview Questions
java servlets  sir, i am doing a project of online examination. i have built a question page that has 25 questions. i have use four radio button for each question(ie four choices). how can i send value and name of each
java - Java Interview Questions
Java Programming  What is Java Programming language
Java Questions - Java Beginners
Java Questions  Can we make 3d games in java
java - Java Interview Questions
java  how to learn java
Java - Java Interview Questions
Java  definition for "USER DEFINE PACKAGE FOR JAVA
java - Java Interview Questions
Java io package hierarchy   What is the hierarchy for Java io Package
java - Java Interview Questions
java  Is JAVA 100% OOPL??  Hi friend, Yes,Java is 100% OOPL. Thanks
java - Java Interview Questions
Java a complete reference  Need a Complete reference on Java.  www.geekinterview.com/question_details/17043
java - Java Interview Questions
Friend, Please visit the following links: http://www.roseindia.net/java/java-tips/background/60garbage_collection.shtml http://www.roseindia.net/java/beginners/GarbageCollection.shtml http://www.roseindia.net/java/example/java/io/code

Ads