{"id":121,"date":"2017-02-15T15:04:00","date_gmt":"2017-02-15T07:04:00","guid":{"rendered":"https:\/\/cn1.club\/?p=121"},"modified":"2025-03-13T20:11:54","modified_gmt":"2025-03-13T12:11:54","slug":"day3-%e7%ac%94%e8%ae%b0-%e9%80%89%e6%8b%a9%e7%bb%93%e6%9e%84if%e6%a0%bc%e5%bc%8f%e8%af%ad%e5%8f%a52%e5%8f%8a%e5%85%b6%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/cn1.club\/?p=121","title":{"rendered":"Day3 \u7b14\u8bb0 \u9009\u62e9\u7ed3\u6784if\u683c\u5f0f\u8bed\u53e52\u53ca\u5176\u4f7f\u7528"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >\/*\nB:\u6267\u884c\u6d41\u7a0b\uff1a\n\u9996\u5148\u8ba1\u7b97\u6bd4\u8f83\u8868\u8fbe\u5f0f\u7684\u503c\uff0c\u770b\u5176\u8fd4\u56de\u503c\u662ftrue\u8fd8\u662ffalse\u3002\n\u5982\u679c\u662ftrue\uff0c\u5c31\u6267\u884c\u8bed\u53e5\u4f531\uff1b\n\u5982\u679c\u662ffalse\uff0c\u5c31\u6267\u884c\u8bed\u53e5\u4f532\uff1b\nC:\u6848\u4f8b\u6f14\u793a\n\na:\u83b7\u53d6\u4e24\u4e2a\u6570\u636e\u4e2d\u8f83\u5927\u7684\u503c\nb:\u5224\u65ad\u4e00\u4e2a\u6570\u636e\u662f\u5947\u6570\u8fd8\u662f\u5076\u6570,\u5e76\u8f93\u51fa\u662f\u5947\u6570\u8fd8\u662f\u5076\u6570\n\u6ce8\u610f\u4e8b\u9879\uff1aelse\u540e\u9762\u662f\u6ca1\u6709\u6bd4\u8f83\u8868\u8fbe\u5f0f\u7684\uff0c\u53ea\u6709if\u540e\u9762\u6709\u3002\n*\/\n\/\/\u83b7\u53d6\u4e24\u4e2a\u6570\u636e\u4e2d\u8f83\u5927\u7684\u503c -\u63d0\u5347\u96be\u5ea6\u4e3a \u4e09\u4e2a   \nclass Demo3_If {\n\tpublic static void main(String&#091;] args) {\n\t\tint a =131;\n\t\tint b =211;\n\t\tint c =12;\n\t\tint max;\n\t\tif (a &gt; b) {\n\t\t\tif ( a &gt; c ) {\n\t\t\t\tSystem.out.println(&quot;A\u5927&quot;);\n\t\t\t}else{\n\t\t\t\tSystem.out.println(&quot;C\u5927&quot;);\n\t\t\t}\n\t\t}else{\n\t\t\tif ( a &lt; b )  {\n\t\t\t\tif ( b &lt; c ) {\n\t\t\t\t\tSystem.out.println(&quot;c\u5927&quot;);\n\t\t\t\t}else{\n\t\t\t\t\tSystem.out.println(&quot;b \u5927&quot;);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\/\/\u6bd4\u8f83\u4e24\u4e2a\u503c\u627e\u51fa\u8f83\u5927\u7684\u2193\n\t\tSystem.out.println(&quot;------------------------&quot;);\n\t\tint d =200;\n\t\tint e =128;\n\t\tint max1;\n\t\tif ( d &gt; e ) {\n\t\t\tmax1 = d;\n\t\t\tSystem.out.println(&quot;d\u5927,\u6570\u503c\u662f:&quot; + d);\n\t\t}else {\n\t\t\tmax1 = e;\n\t\t\tSystem.out.println(&quot;E\u5927,\u6570\u503c\u662f:&quot; + e);\n\t\t}\n\t\tSystem.out.println(&quot;\u6700\u5927\u503c\u662f&quot;+ max1);\n\/\/\u5224\u65ad\u4e00\u4e2a\u6570\u636e\u662f\u5947\u6570\u8fd8\u662f\u5076\u6570\n\t\tSystem.out.println(&quot;=================================&quot;);\n\t\tint q =99;\t\n\t\tif (q % 2 == 0 ) {\t\t\t\t\t\t\/\/\u80fd\u6574\u9664\u4f590\u5219\u5076\u6570,\u53cd\u4e4b\u5947\u6570.\n\t\tSystem.out.println(&quot;\u5076\u6570&quot;);\n\t\t}else{\n\t\tSystem.out.println(&quot;\u5947\u6570&quot;);\n\t\t}\n\n\t\t\t}\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >class Demo4_If {\n\tpublic static void main(String&#091;] args) {\n\t\t\/\/int a ;\n\t\t\/\/a = 2 ;\n\t\tint x = 2;\n\t\tif (x == 1) {\n\t\t\tSystem.out.println(&quot;\u5317\u65b9\u5927\u533a \u6b22\u8fce\u60a8!&quot;);\n\t\t}else if (x == 2) {\n\t\t\tSystem.out.println(&quot;\u5357\u65b9\u5927\u533a \u6b22\u8fce\u60a8!&quot;);\t\n\t\t}else if (x == 3) {\n\t\t\tSystem.out.println(&quot;\u4f53\u9a8c\u670d \u6b22\u8fce\u60a8! \u5145\u503c\u6bd4\u4f8b : 1:200&quot;);\n\t\t}else if (x == 4) {\n\t\t\tSystem.out.println(&quot;\u53cc\u7ebf\u670d\u52a1\u5668 \u6b22\u8fce\u60a8!&quot;);\n\t\t}else{\n\t\tSystem.out.println(&quot;\u62b1\u6b49!\u60a8\u9009\u62e9\u7684\u533a\u53f7\u6709\u8bef!\u65e0\u6cd5\u4e3a\u60a8\u8df3\u8f6c...&quot;);\n\t\t}\n\t}\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":196,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"class_list":["post-121","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-xuexi"],"_links":{"self":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=121"}],"version-history":[{"count":0,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/media\/196"}],"wp:attachment":[{"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}