{"id":294,"date":"2019-09-29T12:45:32","date_gmt":"2019-09-29T12:45:32","guid":{"rendered":"https:\/\/amitsirtutor.com\/blog\/?p=294"},"modified":"2023-09-04T12:06:33","modified_gmt":"2023-09-04T12:06:33","slug":"java-loops","status":"publish","type":"post","link":"https:\/\/amitsirtutor.com\/blog\/java-loops\/","title":{"rendered":"Loops in Java-while,for, do while"},"content":{"rendered":"<p>Loops are used to execute a set of instructions repeatedly when some conditions become true.<\/p>\n<p>loops can be controlled two ways<\/p>\n<p><strong>Entry Controlled Loop<\/strong><br \/>\n<strong>Exit Controlled Loop<\/strong><\/p>\n<p>Loop, where test condition is checked before entering the loop body, known as Entry Controlled Loop.<\/p>\n<p>Example: while loop, for loop<\/p>\n<p>Loop, where test condition is checked after executing the loop body, known as Exit Controlled Loop.<\/p>\n<p>Example: do while loop<\/p>\n<p>There are three types of loops in java.<\/p>\n<p><strong>1)for loop<\/strong><\/p>\n<p>Syntax:<\/p>\n<p>for (initialization ; testing condition; increment\/decrement)<br \/>\n{<br \/>\nstatement(s)<br \/>\n}<\/p>\n<p><strong>2)while loop<\/strong><\/p>\n<p>syntax:<\/p>\n<p>initialization<br \/>\nwhile (boolean condition)<br \/>\n{<br \/>\nloop statements&#8230;<br \/>\n}<\/p>\n<p><strong>3)do-while loop<\/strong><\/p>\n<p>Syntax:<br \/>\ninitialization<br \/>\ndo<br \/>\n{<br \/>\nstatements..<br \/>\n}<br \/>\nwhile (condition);<\/p>\n<p><strong>Other important posts links ::<\/strong><\/p>\n<ul class=\"lcp_catlist\" id=\"lcp_instance_0\"><li><a href=\"https:\/\/amitsirtutor.com\/blog\/what-is-noun-short-explanation\/\">What is noun? Short explanation<\/a><\/li><li><a href=\"https:\/\/amitsirtutor.com\/blog\/online-hindi-tutor-in-bangalore\/\">Online Hindi tutor in Bangalore 8181969432<\/a><\/li><li><a href=\"https:\/\/amitsirtutor.com\/blog\/online-hindi-tutor\/\">Hindi Language Tutors for CBSE ICSE ISC &amp; State Board | Free Demo Class<\/a><\/li><li><a href=\"https:\/\/amitsirtutor.com\/blog\/pronic-number-program-in-java\/\">Pronic number program in Java<\/a><\/li><li class=\"current\"><a href=\"https:\/\/amitsirtutor.com\/blog\/java-loops\/\">Loops in Java-while,for, do while<\/a><\/li><li><a href=\"https:\/\/amitsirtutor.com\/blog\/buzz-number-program-in-java\/\">Buzz number program in java<\/a><\/li><li><a href=\"https:\/\/amitsirtutor.com\/blog\/operators-and-operands-in-java-c-c\/\">Operators and Operands in Java C C++<\/a><\/li><li><a href=\"https:\/\/amitsirtutor.com\/blog\/important-question-for-icse-board-class-10th-computer-application-exam\/\">Important question for ICSE Board class 10th computer application exam<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Loops are used to execute a set of instructions repeatedly when some conditions become true. loops can be controlled two ways Entry Controlled Loop Exit Controlled Loop Loop, where test condition is checked before entering the loop body, known as Entry Controlled Loop. Example: while loop, for loop Loop, where test condition is checked after &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/amitsirtutor.com\/blog\/java-loops\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Loops in Java-while,for, do while&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[33],"tags":[94,95,93,92,91],"class_list":["post-294","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-entry-controlled-loops","tag-exit-controlled-loops","tag-java-loops","tag-loops-in-java","tag-what-is-loops"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Loops in Java-while,for, do while - Computer Home Tutor<\/title>\n<meta name=\"description\" content=\"Loops are used to execute a set of instructions repeatedly when some conditions become true.loops can be controlled two ways Entry Controlled Loop Exit Controlled Loop\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/amitsirtutor.com\/blog\/java-loops\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Loops in Java-while,for, do while - Computer Home Tutor\" \/>\n<meta property=\"og:description\" content=\"Loops are used to execute a set of instructions repeatedly when some conditions become true.loops can be controlled two ways Entry Controlled Loop Exit Controlled Loop\" \/>\n<meta property=\"og:url\" content=\"https:\/\/amitsirtutor.com\/blog\/java-loops\/\" \/>\n<meta property=\"og:site_name\" content=\"Computer Home Tutor\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cbse.icse.computer.tutor\/?ref=bookmarks\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-29T12:45:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-04T12:06:33+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@amitsirtutor\" \/>\n<meta name=\"twitter:site\" content=\"@amitsirtutor\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Loops in Java-while,for, do while - Computer Home Tutor","description":"Loops are used to execute a set of instructions repeatedly when some conditions become true.loops can be controlled two ways Entry Controlled Loop Exit Controlled Loop","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:\/\/amitsirtutor.com\/blog\/java-loops\/","og_locale":"en_US","og_type":"article","og_title":"Loops in Java-while,for, do while - Computer Home Tutor","og_description":"Loops are used to execute a set of instructions repeatedly when some conditions become true.loops can be controlled two ways Entry Controlled Loop Exit Controlled Loop","og_url":"https:\/\/amitsirtutor.com\/blog\/java-loops\/","og_site_name":"Computer Home Tutor","article_publisher":"https:\/\/www.facebook.com\/cbse.icse.computer.tutor\/?ref=bookmarks","article_published_time":"2019-09-29T12:45:32+00:00","article_modified_time":"2023-09-04T12:06:33+00:00","author":"admin","twitter_card":"summary_large_image","twitter_creator":"@amitsirtutor","twitter_site":"@amitsirtutor","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/amitsirtutor.com\/blog\/java-loops\/","url":"https:\/\/amitsirtutor.com\/blog\/java-loops\/","name":"Loops in Java-while,for, do while - Computer Home Tutor","isPartOf":{"@id":"https:\/\/amitsirtutor.com\/blog\/#website"},"datePublished":"2019-09-29T12:45:32+00:00","dateModified":"2023-09-04T12:06:33+00:00","author":{"@id":"https:\/\/amitsirtutor.com\/blog\/#\/schema\/person\/6ffc7c99220402015b230fec020a6fd1"},"description":"Loops are used to execute a set of instructions repeatedly when some conditions become true.loops can be controlled two ways Entry Controlled Loop Exit Controlled Loop","breadcrumb":{"@id":"https:\/\/amitsirtutor.com\/blog\/java-loops\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/amitsirtutor.com\/blog\/java-loops\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/amitsirtutor.com\/blog\/java-loops\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/amitsirtutor.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Loops in Java-while,for, do while"}]},{"@type":"WebSite","@id":"https:\/\/amitsirtutor.com\/blog\/#website","url":"https:\/\/amitsirtutor.com\/blog\/","name":"Computer Home Tutor","description":"C C++ Java Informatics Practices (IP) Python (pH 08181969432)","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/amitsirtutor.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/amitsirtutor.com\/blog\/#\/schema\/person\/6ffc7c99220402015b230fec020a6fd1","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/amitsirtutor.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d466d46a3dd79a20aab6ed49fdda1464fdc29607d5e98029c757f79d29bfbeb3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d466d46a3dd79a20aab6ed49fdda1464fdc29607d5e98029c757f79d29bfbeb3?s=96&d=mm&r=g","caption":"admin"},"description":"We provide home tuition tutor online for computer subjects like Python, C, C++ ,Java , Informatics Practices (IP) , Data structure , Sql for CBSE , ICSE ,ISC ,IB board, b.tech level students."}]}},"_links":{"self":[{"href":"https:\/\/amitsirtutor.com\/blog\/wp-json\/wp\/v2\/posts\/294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/amitsirtutor.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/amitsirtutor.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/amitsirtutor.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/amitsirtutor.com\/blog\/wp-json\/wp\/v2\/comments?post=294"}],"version-history":[{"count":3,"href":"https:\/\/amitsirtutor.com\/blog\/wp-json\/wp\/v2\/posts\/294\/revisions"}],"predecessor-version":[{"id":297,"href":"https:\/\/amitsirtutor.com\/blog\/wp-json\/wp\/v2\/posts\/294\/revisions\/297"}],"wp:attachment":[{"href":"https:\/\/amitsirtutor.com\/blog\/wp-json\/wp\/v2\/media?parent=294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/amitsirtutor.com\/blog\/wp-json\/wp\/v2\/categories?post=294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/amitsirtutor.com\/blog\/wp-json\/wp\/v2\/tags?post=294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}