{"id":681,"date":"2021-07-17T08:21:15","date_gmt":"2021-07-17T08:21:15","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=681"},"modified":"2022-04-29T07:31:26","modified_gmt":"2022-04-29T07:31:26","slug":"difference-between-wait-and-sleep-in-java","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/","title":{"rendered":"Difference between wait() and sleep() in java ?"},"content":{"rendered":"<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"difference-between-wait-and-sleep-in-java\" class=\"color-pink\">Difference between\u00a0<a href=\"https:\/\/forums.wikitechy.com\/question\/what-are-the-differences-between-wait-and-sleep\/\" target=\"_blank\" rel=\"noopener\">wait() and sleep()<\/a>\u00a0in java ?<\/h2>\n<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>\n<\/div>\n<\/div>\n<div class=\"table-responsive\">\n<table class=\"table-bordered table-striped table table-responsive\">\n<tbody>\n<tr>\n<th>Wait() Method<\/th>\n<th>Sleep() Method<\/th>\n<\/tr>\n<tr>\n<td class=\"text-leftalign\">wait() Method of\u00a0<a href=\"https:\/\/www.wikitechy.com\/tutorials\/java\/java-thread\" target=\"_blank\" rel=\"noopener\">thread<\/a>\u00a0class goes in waiting state<br \/>\nand it won\u2019t come back automatically until<br \/>\nwe call the notify() or notifyAll().<\/td>\n<td class=\"text-leftalign\"><a href=\"https:\/\/www.wikitechy.com\/tutorials\/java\/thread-sleep-java\">sleep()<\/a>\u00a0is a method which is used to pause the process for few seconds or the time we want too.<\/td>\n<\/tr>\n<tr>\n<td class=\"text-leftalign\">It is called on Object.<\/td>\n<td class=\"text-leftalign\">It is called on Threads.<\/td>\n<\/tr>\n<tr>\n<td class=\"text-leftalign\">It is an instant member of java.lang.Object class.<\/td>\n<td class=\"text-leftalign\">It is a static member of java.lang.Thread class.<\/td>\n<\/tr>\n<tr>\n<td class=\"text-leftalign\">wait() releases the lock or monitor.<\/td>\n<td class=\"text-leftalign\">sleep() doesn\u2019t releases the lock or monitor while waiting.<\/td>\n<\/tr>\n<tr>\n<td class=\"text-leftalign\">wait() is used for inter-thread communication.<\/td>\n<td class=\"text-leftalign\">sleep() is used to introduce pause on execution, generally.<\/td>\n<\/tr>\n<tr>\n<td class=\"text-leftalign\">It must be called within the synchronized blocks.<\/td>\n<td class=\"text-leftalign\">It may be called from within or outside the synchronized block.<\/td>\n<\/tr>\n<tr>\n<td class=\"text-leftalign\">\n<h3 id=\"wait-example\">wait() Example<\/h3>\n<pre> synchronized(LOCK)\r\n   {  \r\n      LOCK.wait(); \/\/ LOCK is not held\r\n   }<\/pre>\n<\/td>\n<td class=\"text-leftalign\">\n<h3 id=\"sleep-example\">sleep() Example<\/h3>\n<pre>    synchronized(LOCK)\r\n{  \r\n     Thread.sleep(1000); \/\/ LOCK is held\r\n}<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<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>\n","protected":false},"excerpt":{"rendered":"<p>Answer : wait() Method of thread class goes in waiting state &#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4004],"tags":[195,491,360,203,199,214,198,363,209,4399,205,4394,4390,4398,4395,4401,4387,4386,4400,2936,222,4397,196,212,213,15933,4403,4396,286,207,366,204,217,282,4023,483,206,200,4388,197,280,4389,364,4402,4391,4392,4393,968,4404],"class_list":["post-681","post","type-post","status-publish","format-standard","hentry","category-java","tag-accenture-interview-questions-and-answers","tag-applied-materials-interview-questions-and-answers","tag-atos-interview-questions-and-answers","tag-capgemini-interview-questions-and-answers","tag-casting-networks-india-pvt-limited-interview-questions-and-answers","tag-cgi-group-inc-interview-questions-and-answers","tag-chetu-interview-questions-and-answers","tag-ciena-corporation-interview-questions-and-answers","tag-collabera-technologies-interview-questions-and-answers","tag-compare-the-sleep-and-wait-methods-in-java","tag-dell-international-services-india-pvt-ltd-interview-questions-and-answers","tag-difference-between-sleep-and-wait","tag-difference-between-sleep-and-wait-in-java-with-example","tag-difference-between-sleep-and-wait-in-selenium","tag-difference-between-sleep-and-yield","tag-difference-between-sleep1000-and-wait1000","tag-difference-between-wait-and-sleep","tag-difference-between-wait-and-sleep-in-java","tag-difference-between-wait-sleep-and-join-in-java","tag-fis-global-business-solutions-india-pvt-ltd-interview-questions-and-answers","tag-flipkart-interview-questions-and-answers","tag-how-to-use-wait-in-java","tag-ibm-interview-questions-and-answers","tag-indecomm-global-services-interview-questions-and-answers","tag-infosys-technologies-interview-questions-and-answers","tag-infozech-interview-questions-and-answers","tag-java-8-thread-sleep","tag-java-wait-example","tag-lt-infotech-interview-questions-and-answers","tag-mphasis-interview-questions-and-answers","tag-netapp-interview-questions-and-answers","tag-oracle-corporation-interview-questions-and-answers","tag-peoplestrong-interview-questions-and-answers","tag-persistent-systems-interview-questions-and-answers","tag-rbs-india-de-interview-questions-and-answers","tag-reliance-industries-ltd-interview-questions-and-answers","tag-sap-labs-india-pvt-ltd-interview-questions-and-answers","tag-tech-mahindra-interview-questions-and-answers","tag-thread-sleep-and-wait","tag-unitedhealth-group-interview-questions-and-answers","tag-virtusa-consulting-services-pvt-ltd-interview-questions-and-answers","tag-wait-and-sleep-in-java","tag-wells-fargo-interview-questions-and-answers","tag-what-happens-if-sleep-and-wait-executes-in-synchronized-block","tag-what-is-difference-between-wait-and-sleep-method","tag-what-is-wait-in-java","tag-what-is-yield-and-sleep-in-thread-java","tag-wipro-infotech-interview-questions-and-answers","tag-yield-method-in-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Difference between wait() and sleep() in java ? - Java<\/title>\n<meta name=\"description\" content=\"Difference between wait() and sleep() in java ? - wait() Method of thread class goes in waiting state and it won\u2019t come back automatically until we call the notify()\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Difference between wait() and sleep() in java ? - Java\" \/>\n<meta property=\"og:description\" content=\"Difference between wait() and sleep() in java ? - wait() Method of thread class goes in waiting state and it won\u2019t come back automatically until we call the notify()\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-17T08:21:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-29T07:31:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2021\/07\/difference-between-wait-and-sleep-in-java.png\" \/>\n<meta name=\"author\" content=\"Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/difference-between-wait-and-sleep-in-java\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/difference-between-wait-and-sleep-in-java\\\/\"},\"author\":{\"name\":\"Editor\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"headline\":\"Difference between wait() and sleep() in java ?\",\"datePublished\":\"2021-07-17T08:21:15+00:00\",\"dateModified\":\"2022-04-29T07:31:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/difference-between-wait-and-sleep-in-java\\\/\"},\"wordCount\":145,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/difference-between-wait-and-sleep-in-java\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/difference-between-wait-and-sleep-in-java.png\",\"keywords\":[\"Accenture interview questions and answers\",\"Applied Materials interview questions and answers\",\"Atos interview questions and answers\",\"Capgemini interview questions and answers\",\"CASTING NETWORKS INDIA PVT LIMITED interview questions and answers\",\"CGI Group Inc interview questions and answers\",\"Chetu interview questions and answers\",\"Ciena Corporation interview questions and answers\",\"Collabera Technologies interview questions and answers\",\"compare the sleep() and wait() methods in java\",\"Dell International Services India Pvt Ltd interview questions and answers\",\"difference between sleep and wait\",\"difference between sleep and wait in java with example\",\"difference between sleep and wait in selenium\",\"difference between sleep and yield\",\"difference between sleep(1000) and wait(1000)\",\"difference between wait and sleep\",\"difference between wait and sleep in java\",\"difference between wait sleep and join in java\",\"FIS Global Business Solutions India Pvt Ltd interview questions and answers\",\"Flipkart interview questions and answers\",\"how to use wait in java\",\"IBM interview questions and answers\",\"Indecomm Global Services interview questions and answers\",\"Infosys Technologies interview questions and answers\",\"infozech interview questions and answers\",\"java 8 thread sleep\",\"java wait example\",\"L&amp;T Infotech interview questions and answers\",\"Mphasis interview questions and answers\",\"NetApp interview questions and answers\",\"Oracle Corporation interview questions and answers\",\"PeopleStrong interview questions and answers\",\"Persistent Systems interview questions and answers\",\"RBS India De interview questions and answers\",\"Reliance Industries Ltd interview questions and answers\",\"SAP Labs India Pvt Ltd interview questions and answers\",\"Tech Mahindra interview questions and answers\",\"thread sleep and wait\",\"UnitedHealth Group interview questions and answers\",\"Virtusa Consulting Services Pvt Ltd interview questions and answers\",\"wait and sleep in java\",\"Wells Fargo interview questions and answers\",\"what happens if sleep() and wait() executes in synchronized block?\",\"what is difference between wait () and sleep () method?\",\"what is wait () in Java?\",\"what is yield () and sleep () in thread java\",\"Wipro Infotech interview questions and answers\",\"yield method in java\"],\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/difference-between-wait-and-sleep-in-java\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/difference-between-wait-and-sleep-in-java\\\/\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/difference-between-wait-and-sleep-in-java\\\/\",\"name\":\"Difference between wait() and sleep() in java ? - Java\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/difference-between-wait-and-sleep-in-java\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/difference-between-wait-and-sleep-in-java\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/difference-between-wait-and-sleep-in-java.png\",\"datePublished\":\"2021-07-17T08:21:15+00:00\",\"dateModified\":\"2022-04-29T07:31:26+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"description\":\"Difference between wait() and sleep() in java ? - wait() Method of thread class goes in waiting state and it won\u2019t come back automatically until we call the notify()\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/difference-between-wait-and-sleep-in-java\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/java\\\/difference-between-wait-and-sleep-in-java\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/difference-between-wait-and-sleep-in-java.png\",\"contentUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/difference-between-wait-and-sleep-in-java.png\",\"width\":850,\"height\":475},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\",\"name\":\"Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"caption\":\"Editor\"},\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/author\\\/editor\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Difference between wait() and sleep() in java ? - Java","description":"Difference between wait() and sleep() in java ? - wait() Method of thread class goes in waiting state and it won\u2019t come back automatically until we call the notify()","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/","og_locale":"en_US","og_type":"article","og_title":"Difference between wait() and sleep() in java ? - Java","og_description":"Difference between wait() and sleep() in java ? - wait() Method of thread class goes in waiting state and it won\u2019t come back automatically until we call the notify()","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/","og_site_name":"Wikitechy","article_published_time":"2021-07-17T08:21:15+00:00","article_modified_time":"2022-04-29T07:31:26+00:00","og_image":[{"url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2021\/07\/difference-between-wait-and-sleep-in-java.png","type":"","width":"","height":""}],"author":"Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Editor","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/#article","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/"},"author":{"name":"Editor","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"headline":"Difference between wait() and sleep() in java ?","datePublished":"2021-07-17T08:21:15+00:00","dateModified":"2022-04-29T07:31:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/"},"wordCount":145,"commentCount":0,"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2021\/07\/difference-between-wait-and-sleep-in-java.png","keywords":["Accenture interview questions and answers","Applied Materials interview questions and answers","Atos interview questions and answers","Capgemini interview questions and answers","CASTING NETWORKS INDIA PVT LIMITED interview questions and answers","CGI Group Inc interview questions and answers","Chetu interview questions and answers","Ciena Corporation interview questions and answers","Collabera Technologies interview questions and answers","compare the sleep() and wait() methods in java","Dell International Services India Pvt Ltd interview questions and answers","difference between sleep and wait","difference between sleep and wait in java with example","difference between sleep and wait in selenium","difference between sleep and yield","difference between sleep(1000) and wait(1000)","difference between wait and sleep","difference between wait and sleep in java","difference between wait sleep and join in java","FIS Global Business Solutions India Pvt Ltd interview questions and answers","Flipkart interview questions and answers","how to use wait in java","IBM interview questions and answers","Indecomm Global Services interview questions and answers","Infosys Technologies interview questions and answers","infozech interview questions and answers","java 8 thread sleep","java wait example","L&amp;T Infotech interview questions and answers","Mphasis interview questions and answers","NetApp interview questions and answers","Oracle Corporation interview questions and answers","PeopleStrong interview questions and answers","Persistent Systems interview questions and answers","RBS India De interview questions and answers","Reliance Industries Ltd interview questions and answers","SAP Labs India Pvt Ltd interview questions and answers","Tech Mahindra interview questions and answers","thread sleep and wait","UnitedHealth Group interview questions and answers","Virtusa Consulting Services Pvt Ltd interview questions and answers","wait and sleep in java","Wells Fargo interview questions and answers","what happens if sleep() and wait() executes in synchronized block?","what is difference between wait () and sleep () method?","what is wait () in Java?","what is yield () and sleep () in thread java","Wipro Infotech interview questions and answers","yield method in java"],"articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/","name":"Difference between wait() and sleep() in java ? - Java","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/#primaryimage"},"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2021\/07\/difference-between-wait-and-sleep-in-java.png","datePublished":"2021-07-17T08:21:15+00:00","dateModified":"2022-04-29T07:31:26+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"description":"Difference between wait() and sleep() in java ? - wait() Method of thread class goes in waiting state and it won\u2019t come back automatically until we call the notify()","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/java\/difference-between-wait-and-sleep-in-java\/#primaryimage","url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2021\/07\/difference-between-wait-and-sleep-in-java.png","contentUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2021\/07\/difference-between-wait-and-sleep-in-java.png","width":850,"height":475},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757","name":"Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","caption":"Editor"},"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=681"}],"version-history":[{"count":3,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/681\/revisions"}],"predecessor-version":[{"id":4208,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/681\/revisions\/4208"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}