{"id":1102,"date":"2022-02-07T19:03:14","date_gmt":"2022-02-07T19:03:14","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=1102"},"modified":"2022-02-07T19:03:14","modified_gmt":"2022-02-07T19:03:14","slug":"decision-making","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/02\/07\/decision-making\/","title":{"rendered":"Decision Making"},"content":{"rendered":"\n<p>Decision making structures have one or more conditions to be evaluated or tested by the program, along with a statement or statements that are to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.<\/p>\n\n\n\n<p>Following is the general form of a typical decision making structure found in most of the programming languages \u2212<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.tutorialspoint.com\/java\/images\/decision_making.jpg\" alt=\"Decision Making\"\/><\/figure>\n\n\n\n<p>Java programming language provides following types of decision making statements. Click the following links to check their detail.<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-regular\"><table><tbody><tr><th>Sr.No.<\/th><th>Statement &amp; Description<\/th><\/tr><tr><td>1<\/td><td>if statementAn\u00a0<strong>if statement<\/strong>\u00a0consists of a boolean expression followed by one or more statements.<\/td><\/tr><tr><td>2<\/td><td>if&#8230;else statementAn\u00a0<strong>if statement<\/strong>\u00a0can be followed by an optional\u00a0<strong>else statement<\/strong>, which executes when the boolean expression is false.<\/td><\/tr><tr><td>3<\/td><td>nested if statementYou can use one\u00a0<strong>if<\/strong>\u00a0or\u00a0<strong>else if<\/strong>\u00a0statement inside another\u00a0<strong>if<\/strong>\u00a0or\u00a0<strong>else if<\/strong>\u00a0statement(s).<\/td><\/tr><tr><td>4<\/td><td>switch statementA\u00a0<strong>switch<\/strong>\u00a0statement allows a variable to be tested for equality against a list of values.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"the-operator\">The ? : Operator<\/h2>\n\n\n\n<p>We have covered&nbsp;<strong>conditional operator ? :<\/strong>&nbsp;in the previous chapter which can be used to replace&nbsp;<strong>if&#8230;else<\/strong>&nbsp;statements. It has the following general form \u2212<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Exp1 ? Exp2 : Exp3;\n<\/pre>\n\n\n\n<p>Where Exp1, Exp2, and Exp3 are expressions. Notice the use and placement of the colon.<\/p>\n\n\n\n<p>To determine the value of the whole expression, initially exp1 is evaluated.<\/p>\n\n\n\n<ul><li>If the value of exp1 is true, then the value of Exp2 will be the value of the whole expression.<\/li><li>If the value of exp1 is false, then Exp3 is evaluated and its value becomes the value of the entire expression.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Decision making structures have one or more conditions to be evaluated or tested by the program, along with a statement or statements that are to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. Following is the general form [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[238],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1102"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=1102"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1102\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=1102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=1102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=1102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}