{"id":131758,"date":"2019-05-02T07:12:00","date_gmt":"2019-05-01T23:12:00","guid":{"rendered":"http:\/\/itteacheritfreelance.hk\/test\/wordpress\/?guid=35c8736ecb1b84b0b7c2605f711af653"},"modified":"2019-05-02T07:12:00","modified_gmt":"2019-05-01T23:12:00","slug":"java-101-deciding-and-iterating-with-java-statements-3","status":"publish","type":"post","link":"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/2019\/05\/02\/java-101-deciding-and-iterating-with-java-statements-3\/","title":{"rendered":"Java 101: Deciding and iterating with Java statements"},"content":{"rendered":"<article>\n<section class=\"page\">\n<p>Java applications evaluate expressions in the context of <em>statements<\/em>, which are used for tasks such as declaring a variable, making a decision, or iterating over statements. A statement can be expressed as a simple or a compound statement:<\/p>\n<ul>\n<li>A <strong>simple statement<\/strong> is a single standalone instruction for performing a task; it must be terminated with a semicolon character (<code>;<\/code>).<\/li>\n<li>A <strong>compound statement<\/strong> is a sequence of simple and other compound statements located between open- and close-brace characters (<code>{<\/code> and <code>}<\/code>), which delimit the compound statement&#8217;s boundaries. Compound statements can be empty, will appear wherever simple statements appear, and are alternatively known as <em>blocks<\/em>. A compound statement is not terminated with a semicolon.<\/li>\n<\/ul>\n<p>In this tutorial, you&#8217;ll learn how to use statements in your Java programs. You can use statements such as <code>if<\/code>, <code>if-else<\/code>, <code>switch<\/code>, <code>for<\/code>, and <code>while<\/code> to declare variables and specify expressions, make decisions, iterate (or loop) over statements, break and continue iteration, and more. I&#8217;ll leave some of the more exotic statements&#8211;such as statements for returning values from called methods and for throwing exceptions&#8211;for future Java 101 tutorials.<\/p>\n<p class=\"jumpTag\"><a href=\"https:\/\/www.javaworld.com\/article\/2941281\/java-101-deciding-and-iterating-with-java-statements.html#jump\">To read this article in full, please click here<\/a><\/p>\n<\/section>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>Java applications evaluate expressions in the context of statements, which are used for tasks such as declaring a variable, making a decision, or iterating over statements. A statement can be expressed as a simple or a compound statement:<br \/>\nA simple s&#8230; <a href=\"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/2019\/05\/02\/java-101-deciding-and-iterating-with-java-statements-3\/\">\u95b1\u8b80\u5168\u6587 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":123,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"slim_seo":[],"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[451,2,7],"tags":[398,402,397,414,413,410,409,407,408,406,399,400,394,318,558,560,555,561,566,553,554,586,585,563,562,183,567,524,10,401,396,403,412,411,395,405,404,457,454,319,316],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7prtj-yh8","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-json\/wp\/v2\/posts\/131758"}],"collection":[{"href":"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-json\/wp\/v2\/users\/123"}],"replies":[{"embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-json\/wp\/v2\/comments?post=131758"}],"version-history":[{"count":1,"href":"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-json\/wp\/v2\/posts\/131758\/revisions"}],"predecessor-version":[{"id":131761,"href":"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-json\/wp\/v2\/posts\/131758\/revisions\/131761"}],"wp:attachment":[{"href":"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-json\/wp\/v2\/media?parent=131758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-json\/wp\/v2\/categories?post=131758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-json\/wp\/v2\/tags?post=131758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}