<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>what is wait () in Java? - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/what-is-wait-in-java/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/what-is-wait-in-java/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Fri, 29 Apr 2022 07:31:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>what is wait () in Java? - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/what-is-wait-in-java/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Difference between wait() and sleep() in java ?</title>
		<link>https://www.wikitechy.com/interview-questions/java/difference-between-wait-and-sleep-in-java/</link>
					<comments>https://www.wikitechy.com/interview-questions/java/difference-between-wait-and-sleep-in-java/#respond</comments>
		
		<dc:creator><![CDATA[Editor]]></dc:creator>
		<pubDate>Sat, 17 Jul 2021 08:21:15 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Accenture interview questions and answers]]></category>
		<category><![CDATA[Applied Materials interview questions and answers]]></category>
		<category><![CDATA[Atos interview questions and answers]]></category>
		<category><![CDATA[Capgemini interview questions and answers]]></category>
		<category><![CDATA[CASTING NETWORKS INDIA PVT LIMITED interview questions and answers]]></category>
		<category><![CDATA[CGI Group Inc interview questions and answers]]></category>
		<category><![CDATA[Chetu interview questions and answers]]></category>
		<category><![CDATA[Ciena Corporation interview questions and answers]]></category>
		<category><![CDATA[Collabera Technologies interview questions and answers]]></category>
		<category><![CDATA[compare the sleep() and wait() methods in java]]></category>
		<category><![CDATA[Dell International Services India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[difference between sleep and wait]]></category>
		<category><![CDATA[difference between sleep and wait in java with example]]></category>
		<category><![CDATA[difference between sleep and wait in selenium]]></category>
		<category><![CDATA[difference between sleep and yield]]></category>
		<category><![CDATA[difference between sleep(1000) and wait(1000)]]></category>
		<category><![CDATA[difference between wait and sleep]]></category>
		<category><![CDATA[difference between wait and sleep in java]]></category>
		<category><![CDATA[difference between wait sleep and join in java]]></category>
		<category><![CDATA[FIS Global Business Solutions India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Flipkart interview questions and answers]]></category>
		<category><![CDATA[how to use wait in java]]></category>
		<category><![CDATA[IBM interview questions and answers]]></category>
		<category><![CDATA[Indecomm Global Services interview questions and answers]]></category>
		<category><![CDATA[Infosys Technologies interview questions and answers]]></category>
		<category><![CDATA[infozech interview questions and answers]]></category>
		<category><![CDATA[java 8 thread sleep]]></category>
		<category><![CDATA[java wait example]]></category>
		<category><![CDATA[L&T Infotech interview questions and answers]]></category>
		<category><![CDATA[Mphasis interview questions and answers]]></category>
		<category><![CDATA[NetApp interview questions and answers]]></category>
		<category><![CDATA[Oracle Corporation interview questions and answers]]></category>
		<category><![CDATA[PeopleStrong interview questions and answers]]></category>
		<category><![CDATA[Persistent Systems interview questions and answers]]></category>
		<category><![CDATA[RBS India De interview questions and answers]]></category>
		<category><![CDATA[Reliance Industries Ltd interview questions and answers]]></category>
		<category><![CDATA[SAP Labs India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Tech Mahindra interview questions and answers]]></category>
		<category><![CDATA[thread sleep and wait]]></category>
		<category><![CDATA[UnitedHealth Group interview questions and answers]]></category>
		<category><![CDATA[Virtusa Consulting Services Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[wait and sleep in java]]></category>
		<category><![CDATA[Wells Fargo interview questions and answers]]></category>
		<category><![CDATA[what happens if sleep() and wait() executes in synchronized block?]]></category>
		<category><![CDATA[what is difference between wait () and sleep () method?]]></category>
		<category><![CDATA[what is wait () in Java?]]></category>
		<category><![CDATA[what is yield () and sleep () in thread java]]></category>
		<category><![CDATA[Wipro Infotech interview questions and answers]]></category>
		<category><![CDATA[yield method in java]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=681</guid>

					<description><![CDATA[Answer : wait() Method of thread class goes in waiting state ...]]></description>
										<content:encoded><![CDATA[<div class="TextHeading">
<div class="hddn">
<h2 id="difference-between-wait-and-sleep-in-java" class="color-pink">Difference between <a href="https://forums.wikitechy.com/question/what-are-the-differences-between-wait-and-sleep/" target="_blank" rel="noopener">wait() and sleep()</a> in java ?</h2>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4206" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/difference-between-wait-and-sleep-in-java.png" alt="" width="850" height="475" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/difference-between-wait-and-sleep-in-java.png 850w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/difference-between-wait-and-sleep-in-java-300x168.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/difference-between-wait-and-sleep-in-java-768x429.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/difference-between-wait-and-sleep-in-java-390x218.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/difference-between-wait-and-sleep-in-java-820x458.png 820w" sizes="(max-width: 850px) 100vw, 850px" /></p>
</div>
</div>
<div class="table-responsive">
<table class="table-bordered table-striped table table-responsive">
<tbody>
<tr>
<th>Wait() Method</th>
<th>Sleep() Method</th>
</tr>
<tr>
<td class="text-leftalign">wait() Method of <a href="https://www.wikitechy.com/tutorials/java/java-thread" target="_blank" rel="noopener">thread</a> class goes in waiting state<br />
and it won’t come back automatically until<br />
we call the notify() or notifyAll().</td>
<td class="text-leftalign"><a href="https://www.wikitechy.com/tutorials/java/thread-sleep-java">sleep()</a> is a method which is used to pause the process for few seconds or the time we want too.</td>
</tr>
<tr>
<td class="text-leftalign">It is called on Object.</td>
<td class="text-leftalign">It is called on Threads.</td>
</tr>
<tr>
<td class="text-leftalign">It is an instant member of java.lang.Object class.</td>
<td class="text-leftalign">It is a static member of java.lang.Thread class.</td>
</tr>
<tr>
<td class="text-leftalign">wait() releases the lock or monitor.</td>
<td class="text-leftalign">sleep() doesn’t releases the lock or monitor while waiting.</td>
</tr>
<tr>
<td class="text-leftalign">wait() is used for inter-thread communication.</td>
<td class="text-leftalign">sleep() is used to introduce pause on execution, generally.</td>
</tr>
<tr>
<td class="text-leftalign">It must be called within the synchronized blocks.</td>
<td class="text-leftalign">It may be called from within or outside the synchronized block.</td>
</tr>
<tr>
<td class="text-leftalign">
<h3 id="wait-example">wait() Example</h3>
<pre> synchronized(LOCK)
   {  
      LOCK.wait(); // LOCK is not held
   }</pre>
</td>
<td class="text-leftalign">
<h3 id="sleep-example">sleep() Example</h3>
<pre>    synchronized(LOCK)
{  
     Thread.sleep(1000); // LOCK is held
}</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p><img decoding="async" class="alignnone wp-image-4207 size-full" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/sleep-and-wait-in-java.png" alt="" width="1920" height="1080" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/sleep-and-wait-in-java.png 1920w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/sleep-and-wait-in-java-300x169.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/sleep-and-wait-in-java-1024x576.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/sleep-and-wait-in-java-768x432.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/sleep-and-wait-in-java-1536x864.png 1536w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/sleep-and-wait-in-java-390x219.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/sleep-and-wait-in-java-820x461.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2021/07/sleep-and-wait-in-java-1180x664.png 1180w" sizes="(max-width: 1920px) 100vw, 1920px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/java/difference-between-wait-and-sleep-in-java/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
