{"id":154,"date":"2023-11-08T20:56:07","date_gmt":"2023-11-08T12:56:07","guid":{"rendered":"http:\/\/ericw.top\/?p=154"},"modified":"2023-11-09T11:14:08","modified_gmt":"2023-11-09T03:14:08","slug":"java%e5%9f%ba%e7%a1%80%e8%af%ad%e6%b3%95","status":"publish","type":"post","link":"http:\/\/ericw.top\/?p=154","title":{"rendered":"JAVA\u57fa\u7840\u8bed\u6cd5"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"toc-0\">\u4e00\u3001\u6570\u636e\u7c7b\u578b<\/h2>\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-1\">1. JAVA\u6709\u54ea\u4e9b\u6570\u636e\u7c7b\u578b<\/h3>\n\n\n<p>\u5b9a\u4e49\uff1aJava\u8bed\u8a00\u662f\u5f3a\u7c7b\u578b\u8bed\u8a00\uff0c\u6bcf\u4e00\u79cd\u6570\u636e\u90fd\u6709\u660e\u5177\u4f53\u7684\u6570\u636e\u7c7b\u578b\uff0c\u800c\u4e14\u90fd\u5206\u914d\u7387\u4e0d\u540c\u7684\u5185\u5b58\u5927\u5c0f\u3002<\/p>\n\n\n<p>\u5206\u7c7b\uff1a<br><\/p>\n\n<ul>\n<li>\u57fa\u672c\u6570\u636e\u7c7b\u578b\n<ul>\n<li>\u6570\u503c\u578b<\/li>\n<li>\u6574\u6570\u7c7b\u578b<\/li>\n<li>\u6d6e\u70b9\u7c7b\u578b<\/li>\n<li>\u5b57\u7b26\u578b<\/li>\n<li>\u5e03\u5c14\u578b<\/li>\n<\/ul><\/li>\n<li>\u5f15\u7528\u6570\u636e\u7c7b\u578b\n<ul>\n<li>\u7c7b<\/li>\n<li>\u63a5\u53e3<\/li>\n<li>\u6570\u7ec4<\/li>\n<\/ul><\/li>\n<\/ul>\n<p><a href=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_676b7674f9b22b55a9b4b284a64de2aa.jpg\"><img decoding=\"async\" src=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_676b7674f9b22b55a9b4b284a64de2aa.jpg\" alt=\"\" \/><\/a><\/p>\n<h3 id=\"toc-2\">2. \u7f16\u7801<\/h3>\n<p><strong>JAVA\u8bed\u8a00\u91c7\u7528Unicode\u7f16\u7801\u6807\u51c6<\/strong>\n<strong>Unicode<\/strong>\u4ed6\u4e3a\u6bcf\u4e2a\u5b57\u7b26\u5b9a\u4e86\u4e00\u4e2a\u6570\u503c\n\u56e0\u6b64\u5728\u4efb\u4f55\u8bed\u8a00\u3001\u5e73\u53f0\u3001\u7a0b\u5e8f\u90fd\u53ef\u4ee5\u4f7f\u7528<\/p>\n<h3 id=\"toc-3\">3. \u6ce8\u91ca<\/h3>\n<p>JAVA\u6ce8\u91ca\uff1a\u89e3\u91ca\u8bf4\u660e\u7a0b\u5e8f\u7684\u6587\u5b57\n\u5206\u7c7b\uff1a\n\u5355\u884c\u6ce8\u91ca\n<code class=\"prettyprint\" >\/\/\u5355\u884c\u6ce8\u91ca<\/code>\n\u591a\u884c\u6ce8\u91ca\n<code class=\"prettyprint\" >\/* \u591a\u884c\u6ce8\u91ca *\/<\/code>\n\u6587\u6863\u6ce8\u91ca\n<code class=\"prettyprint\" >\/** \u6587\u6863\u6ce8\u91ca *\/<\/code><\/p>\n<p>\u4f5c\u7528\uff1a\n\u5728\u7a0b\u5e8f\u4e2d\uff0c\u52a0\u5165\u6ce8\u91ca\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\uff0c\u6709\u5229\u4e8e\u4ee3\u7801\u8c03\u8bd5\u548c\u4fee\u6539\u3002\n<strong>\u6ce8\u91ca\u7684\u5185\u5bb9\u5728\u7a0b\u5e8f\u7f16\u8bd1\u4e2d\u4f1a\u5ffd\u89c6\uff0c\u4e0d\u4f1a\u4ea7\u751f\u76ee\u6807\u4ee3\u7801<\/strong><\/p>\n<h3 id=\"toc-4\">4. \u8bbf\u95ee\u4fee\u9970\u7b26<\/h3>\n<p>JAVA\u8bed\u8a00\u4e2d\uff0c\u53ef\u4ee5\u7ed9\u53d8\u91cf\u3001\u7c7b\u3001\u65b9\u6cd5\u3001\u6784\u9020\u65b9\u6cd5\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\n<code class=\"prettyprint\" >public  private  protected  default<\/code><\/p>\n<p><strong>private : \u5728\u540c\u4e00\u7c7b\u5185\u53ef\u89c1\u3002\u4f7f\u7528\u5bf9\u8c61\uff1a\u53d8\u91cf\u3001\u65b9\u6cd5\u3002 \u6ce8\u610f\uff1a\u4e0d\u80fd\u4fee\u9970\u7c7b\uff08\u5916\u90e8\u7c7b\uff09<\/strong><\/p>\n<p><strong>default (\u5373\u7f3a\u7701\uff0c\u4ec0\u4e48\u4e5f\u4e0d\u5199\uff0c\u4e0d\u4f7f\u7528\u4efb\u4f55\u5173\u952e\u5b57\uff09: \u5728\u540c\u4e00\u5305\u5185\u53ef\u89c1\uff0c\u4e0d\u4f7f\u7528\u4efb\u4f55\u4fee\u9970\u7b26\u3002\u4f7f\u7528\u5bf9\u8c61\uff1a\u7c7b\u3001\u63a5\u53e3\u3001\u53d8\u91cf\u3001\u65b9\u6cd5\u3002<\/strong><\/p>\n<p><strong>protected : \u5bf9\u540c\u4e00\u5305\u5185\u7684\u7c7b\u548c\u6240\u6709\u5b50\u7c7b\u53ef\u89c1\u3002\u4f7f\u7528\u5bf9\u8c61\uff1a\u53d8\u91cf\u3001\u65b9\u6cd5\u3002 \u6ce8\u610f\uff1a\u4e0d\u80fd\u4fee\u9970\u7c7b\uff08\u5916\u90e8\u7c7b\uff09\u3002<\/strong><\/p>\n<p><strong>public : \u5bf9\u6240\u6709\u7c7b\u53ef\u89c1\u3002\u4f7f\u7528\u5bf9\u8c61\uff1a\u7c7b\u3001\u63a5\u53e3\u3001\u53d8\u91cf\u3001\u65b9\u6cd5<\/strong><\/p>\n<p><a href=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_f220d429d9dfa1c73806cd6b200e6af5.jpg\"><img decoding=\"async\" src=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_f220d429d9dfa1c73806cd6b200e6af5.jpg\" alt=\"\" \/><\/a><\/p>\n<h3 id=\"toc-5\">5. \u8fd0\u7b97\u7b26<\/h3>\n<h4 id=\"toc-6\">\u7b97\u672f\u8fd0\u7b97\u7b26<\/h4>\n<p><a href=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_13020188714c4837561d2e12e84112f3.jpg\"><img decoding=\"async\" src=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_13020188714c4837561d2e12e84112f3.jpg\" alt=\"\" \/>\n<\/a><\/p>\n<h4 id=\"toc-7\">\u5173\u7cfb\u8fd0\u7b97\u7b26<\/h4>\n<p><a href=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_7a3d44a912c9302f00e024379876c18c.jpg\"><img decoding=\"async\" src=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_7a3d44a912c9302f00e024379876c18c.jpg\" alt=\"\" \/><\/a><\/p>\n<h4 id=\"toc-8\">\u4f4d\u8fd0\u7b97\u7b26<\/h4>\n<p><a href=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_0982abb69a9ab88e5dc8c791168557cb.jpg\"><img decoding=\"async\" src=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_0982abb69a9ab88e5dc8c791168557cb.jpg\" alt=\"\" \/><\/a><\/p>\n<h4 id=\"toc-9\">\u903b\u8f91\u8fd0\u7b97\u7b26<\/h4>\n<p><a href=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_6a8e16b4d6a135f6f15e969871ccc56f.jpg\"><img decoding=\"async\" src=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_6a8e16b4d6a135f6f15e969871ccc56f.jpg\" alt=\"\" \/><\/a><\/p>\n<h4 id=\"toc-10\">\u8d4b\u503c\u8fd0\u7b97\u7b26<\/h4>\n<p><a href=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_03fb5d7d26e8ee1c17b37b948760ed71.jpg\"><img decoding=\"async\" src=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_03fb5d7d26e8ee1c17b37b948760ed71.jpg\" alt=\"\" \/><\/a><\/p>\n<h3 id=\"toc-11\">6. \u5173\u952e\u5b57<\/h3>\n<p><a href=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_8ca2dde856c24698687a799b7bf1b030.jpg\"><img decoding=\"async\" src=\"http:\/\/ericw.top\/wp-content\/uploads\/2023\/11\/wp_editor_md_8ca2dde856c24698687a799b7bf1b030.jpg\" alt=\"\" \/><\/a><\/p>\n<h3 id=\"toc-12\">7. \u6d41\u7a0b\u63a7\u5236\u8bed\u53e5<\/h3>\n<p>JAVA\u4e2d\u6709\u4e09\u79cd\u4ee3\u7801\u6267\u884c\u7ed3\u6784\n**1. \u987a\u5e8f\u7ed3\u6784<\/p>\n<ol start=\"2\">\n<li>\u5206\u652f\u7ed3\u6784<\/li>\n<li>\u5faa\u73af\u7ed3\u6784**<\/li>\n<\/ol>\n<h4 id=\"toc-13\">1. \u987a\u5e8f\u7ed3\u6784<\/h4>\n<p>\u9ed8\u8ba4\u8bed\u6cd5\u5c31\u662f\u987a\u5e8f\u7ed3\u6784\n\u9ed8\u8ba4\u7684\u4ee3\u7801\u6267\u884c\u987a\u5e8f\u5c31\u662f\u4ece\u4e0a\u5f80\u4e0b \u4f9d\u6b21\u6267\u884c<\/p>\n<h4 id=\"toc-14\">2. \u5206\u652f\u7ed3\u6784<\/h4>\n<p>\u901a\u8fc7\u5224\u65ad\u6761\u4ef6\u6765\u6267\u884c\u7684\u5206\u652f\u8bed\u53e5\uff0c\u6709<code class=\"prettyprint\" >if<\/code>\u548c<code class=\"prettyprint\" >switch<\/code>\u4e24\u79cd\u7ed3\u6784<\/p>\n<pre><code class=\"prettyprint\" >\/*\n * if\u8bed\u53e5\uff1a\n *     if(\u5173\u7cfb\u8868\u8fbe\u5f0f){\n *        \u8bed\u53e5\u4f53\uff1b\n *     }\n * \u6267\u884c\u6d41\u7a0b\uff1a\n *    1.\u8ba1\u7b97\u5173\u7cfb\u8868\u8fbe\u5f0f\u7684\u503c\uff0c\u770b\u7ed3\u679c\u662ftrue\u8fd8\u662ffalse\uff1b\n *    2.\u82e5\u662ftrue\u5219\u6267\u884c\u8bed\u53e5\u4f53\uff1b\n *    3.\u82e5\u662ffalse\u5219\u4e0d\u6267\u884c\u8bed\u53e5\u4f53\n *\/\npublic static void main(String[] args) {\n    if(10 \uff1d\uff1d 10){\n        System.out.println(&quot;\u4e24\u4e2a\u6570\u76f8\u7b49&quot;);\n    }\n}<\/code><\/pre>\n<hr \/>\n<pre><code class=\"prettyprint\" >\/*\n * if-else\u8bed\u53e5\uff1a\n *     if(\u5173\u7cfb\u8868\u8fbe\u5f0f){\n *        \u8bed\u53e5\u4f531;\n *     }else{\n *        \u8bed\u53e5\u4f532;\n *     }\n * \u6267\u884c\u6d41\u7a0b\uff1a\n *    1.\u8ba1\u7b97\u5173\u7cfb\u8868\u8fbe\u5f0f\u7684\u503c\uff0c\u770b\u7ed3\u679c\u662ftrue\u8fd8\u662ffalse\uff1b\n *    2.\u82e5\u662ftrue\u5219\u6267\u884c\u8bed\u53e5\u4f531\uff1b\n *    3.\u82e5\u662ffalse\u5219\u6267\u884c\u8bed\u53e5\u4f532\n *\/\npublic static void main(String[] args) {\n    if(10 &lt; 10){\n        System.out.println(&quot;10 &lt; 10&quot;);\n    }else{\n        System.out.println(&quot;10 \u4e0d\u5c0f\u4e8e 10&quot;);\n    }\n    \/\/ \u8f93\u51fa\uff1a10 \u4e0d\u5c0f\u4e8e 10\n}<\/code><\/pre>\n<hr \/>\n<pre><code class=\"prettyprint\" >\/*\n * if-else if-else\u8bed\u53e5\uff1a\n *     if(\u5173\u7cfb\u8868\u8fbe\u5f0f1){\n *        \u8bed\u53e5\u4f531;\n *     }else if(\u5173\u7cfb\u8868\u8fbe\u5f0f2){\n *        \u8bed\u53e5\u4f532;\n *     }else{\n *         \u8bed\u53e5\u4f533;\n *     }\n * \u6267\u884c\u6d41\u7a0b\uff1a\n *    1.\u8ba1\u7b97\u5173\u7cfb\u8868\u8fbe\u5f0f1\u7684\u503c\uff0c\u770b\u7ed3\u679c\u662ftrue\u8fd8\u662ffalse\uff1b\n *    2.\u82e5\u662ftrue\u5219\u6267\u884c\u8bed\u53e5\u4f531\uff1b\n *    3.\u82e5\u662ffalse\u5219\u8ba1\u7b97\u5173\u7cfb\u8868\u8fbe\u5f0f2\u7684\u503c\uff0c\u770b\u7ed3\u679c\u662ftrue\u8fd8\u662ffalse\uff1b\n *    4.\u82e5\u662ftrue\u5219\u6267\u884c\u8bed\u53e5\u4f532\uff1b\n *    5.\u82e5\u662ffalse\u5219\u6267\u884c\u8bed\u53e5\u4f533\uff1b\n *\/\npublic static void main(String[] args) {\n    if(10 &lt; 10){\n        System.out.println(&quot;10 &lt; 10&quot;);\n    }else if(10 &gt; 10){\n        System.out.println(&quot;10 &lt; 10&quot;);\n    }else if(10 \uff1d\uff1d 10){\n        System.out.println(&quot;10 == 10&quot;);\n    }else {\n        System.out.println(&quot;\u5176\u4ed6&quot;);\n    }\n}\n\n\/*  switch\u8bed\u53e5\uff1a\n *  switch(\u8868\u8fbe\u5f0f){\n *      case \u503c1:\n *              \u8bed\u53e5\u4f531; break;\n *      case \u503c2:\n *              \u8bed\u53e5\u4f532; break;\n *      ...\n *      default:\n *              \u8bed\u53e5\u4f53n+1;\n *              break; \/\/ \u4e00\u822c\u4e0d\u5199\n *  }\n * \u6267\u884c\u6d41\u7a0b\uff1a\n *    1.\u8ba1\u7b97\u8868\u8fbe\u5f0f\u7684\u503c\uff1b\n *    2.\u5c06\u5f97\u5230\u7684\u503c\u4f9d\u6b21\u4e0ecase\u540e\u7684\u503c\u8fdb\u884c\u5339\u914d\uff0c\u4e00\u65e6\u5339\u914d\u6210\u529f\u5219\u6267\u884c\u76f8\u5e94\u7684\u8bed\u53e5\u4f53\uff0c\u9047\u5230break\u5219\u7ed3\u675f\uff1b\n *    3.\u82e5\u662f\u90fd\u4e0d\u5339\u914d\uff0c\u5219\u6267\u884c\u8bed\u53e5\u4f53n+1,\u5219\u7ed3\u675f\uff1b\n *\/\npublic static void main(String[] args) {\n    switch (&#039;C&#039;){\n        case &#039;A&#039;:\n            System.out.println(&quot;A&quot;); break;\n        case &#039;c&#039;:\n             System.out.println(&quot;\u5c0fc&quot;); break;\n        case &#039;C&#039;:\n            System.out.println(&quot;\u5927C&quot;); break;\n        default:\n            System.out.println(&quot;\u5176\u4ed6&quot;);\n    }\n    \/\/ \u8f93\u51fa\uff1a\u5927C\n}<\/code><\/pre>\n<h4 id=\"toc-15\">3. \u5faa\u73af\u7ed3\u6784<\/h4>\n<p>\u5f53\u4e00\u6bb5\u4ee3\u7801\u9700\u8981\u5faa\u73af\u6267\u884c\u65f6\uff0c\u9700\u8981\u7528\u5230<strong>\u5faa\u73af\u8bed\u53e5<\/strong><\/p>\n<pre><code class=\"prettyprint\" >\/*\n * for\u5faa\u73af\u8bed\u53e5\uff1a\n *   for(\u521d\u59cb\u5316\u8bed\u53e5; \u5224\u65ad\u6761\u4ef6\u8bed\u53e5; \u63a7\u5236\u6761\u4ef6\u8bed\u53e5){\n *      \u5faa\u73af\u4f53\u8bed\u53e5;\n *   }\n * \u6267\u884c\u6d41\u7a0b\uff1a\n *   1.\u6267\u884c\u521d\u59cb\u5316\u8bed\u53e5;\n *   2.\u6267\u884c\u5224\u65ad\u6761\u4ef6\u8bed\u53e5;\n *   3.\u6267\u884c\u5faa\u73af\u4f53\u8bed\u53e5;\n *   4.\u6267\u884c\u63a7\u5236\u6761\u4ef6\u8bed\u53e5;\n *   5.\u56de\u52302\u5728\u5f00\u59cb\u6267\u884c\uff0c\u76f4\u81f3\u4e0d\u7b26\u5408\u63a7\u5236\u6761\u4ef6\u8bed\u53e5.\n *\/\npublic static void main(String[] args) {\n    int sum = 0;\n    for(int i=1; i&lt;=10; i++){\n        sum+=i;\n    }\n    System.out.println(&quot;sum:&quot;+sum);\n    \/\/ \u8f93\u51fa\uff1a55\n}\n\n\/*\n * while\u5faa\u73af\u8bed\u53e5\uff1a\n *      while(\u5224\u65ad\u6761\u4ef6\u8bed\u53e5){\n *          \u5faa\u73af\u4f53\u8bed\u53e5;\n *          \u63a7\u5236\u6761\u4ef6\u8bed\u53e5;\n *      }\n * \u6267\u884c\u6d41\u7a0b\uff1a\n *   1.\u6267\u884c\u5224\u65ad\u6761\u4ef6\u8bed\u53e5;\n *   2.\u6267\u884c\u5faa\u73af\u4f53\u8bed\u53e5;\n *   3.\u6267\u884c\u63a7\u5236\u6761\u4ef6\u8bed\u53e5;\n *   4.\u56de\u52301\u5728\u5f00\u59cb\u6267\u884c\uff0c\u76f4\u81f3\u4e0d\u7b26\u5408\u63a7\u5236\u6761\u4ef6\u8bed\u53e5.\n *\/\npublic static void main(String[] args) {\n    int sum = 0;\n    int i = 1;\n    while(i &lt;= 10){\n        sum+=i;\n        i++;\n    }\n    System.out.println(&quot;sum:&quot;+sum);\n    \/\/ \u8f93\u51fa\uff1a55\n}\n\n\/*\n * do...while\u5faa\u73af\u8bed\u53e5\uff1a\n *      do{\n *          \u5faa\u73af\u4f53\u8bed\u53e5;\n *          \u63a7\u5236\u6761\u4ef6\u8bed\u53e5;\n *      }while(\u5224\u65ad\u6761\u4ef6\u8bed\u53e5);\n * \u6267\u884c\u6d41\u7a0b\uff1a\n *   1.\u6267\u884c\u5faa\u73af\u4f53\u8bed\u53e5;\n *   2.\u6267\u884c\u63a7\u5236\u6761\u4ef6\u8bed\u53e5;\n *   3.\u6267\u884c\u5224\u65ad\u6761\u4ef6\u8bed\u53e5;\n *   4.\u56de\u52301\u5728\u5f00\u59cb\u6267\u884c\uff0c\u76f4\u81f3\u4e0d\u7b26\u5408\u63a7\u5236\u6761\u4ef6\u8bed\u53e5.\n *\/\npublic static void main(String[] args) {\n    int sum = 0;\n    int i = 1;\n    do{\n        sum+=i;\n        i++;\n    }while(i &lt;= 10);\n    System.out.println(&quot;sum:&quot;+sum);\n    \/\/ \u8f93\u51fa\uff1a55<\/code><\/pre>\n<p><strong>for  while     \uff08\u5148\u5224\u65ad\u540e\u6267\u884c\uff09<\/strong><\/p>\n<p><strong>do...while     \uff08\u5148\u6267\u884c\u540e\u5224\u65ad\uff09<\/strong><\/p>\n<p><strong>for \u5faa\u73af\uff1a\u7528\u4e8e\u63a7\u5236\u5faa\u73af\u7684\u90a3\u4e2a\u53d8\u91cf\uff0c\u5728\u5faa\u73af\u7ed3\u675f\u540e\uff0c\u5c31\u4f1a\u4ece\u5185\u5b58\u4e2d\u6d88\u5931\uff0c\u5faa\u73af\u7ed3\u675f\u540e\uff0c\u4e0d\u80fd\u7ee7\u7eed\u4f7f\u7528<\/strong><\/p>\n<h4 id=\"toc-16\">4. \u5faa\u73af\u5d4c\u5957<\/h4>\n<p>\u5f53\u4e00\u6bb5\u4ee3\u7801\u5faa\u73af\u65f6\uff0c\u91cc\u9762\u7684\u4ee3\u7801\u4e5f\u9700\u8981\u5faa\u73af\u65f6\uff0c\u5c31\u9700\u8981\u5faa\u73af\u5d4c\u5957\n\u7b80\u5355\u6765\u8bf4\u5c31\u662f\uff1a<strong>\u548b\u5faa\u73af\u8bed\u53e5\u4e2d  \u7ee7\u7eed\u51fa\u73b0\u5faa\u73af\u8bed\u53e5<\/strong><\/p>\n<hr \/>\n<blockquote>\n<h2>\u4f8b\u5982\uff1a\u5c0f\u660e\u5728\u64cd\u573a\u8dd1\u5708\u65f6\uff0c\u9700\u8981\u7ed5\u64cd\u573a\u8dd1\u5708(\u8dd110\u5708)\uff0c\u6bcf\u8dd120m\u8981\u505c\u4e0b\u6765\u505a\u4e2a\u8bb0\u5f55\u3002\n<code class=\"prettyprint\" >for(int i=1; i&lt;=10; i++){<\/code>\n<code class=\"prettyprint\" >    \u8dd1\u4e00\u5708<\/code>\n<code class=\"prettyprint\" >    for(int i=20m; i&lt;=\u4e00\u5708\uff1b i++){<\/code>\n<code class=\"prettyprint\" >    \u505a\u8bb0\u5f55<\/code>\n<code class=\"prettyprint\" >    }<\/code>\n<code class=\"prettyprint\" >}<\/code>\n\u8fd9\u79cd\u60c5\u51b5\u5c31\u9700\u8981\u7528\u5230<strong>\u5faa\u73af\u5d4c\u5957<\/strong><\/h2>\n<\/blockquote>\n<h4 id=\"toc-17\">5. \u63a7\u5236\u5faa\u73af\u7ed3\u675f\u8bed\u53e5<\/h4>\n<p>Java\u63d0\u4f9b\u4e86break\uff0ccontinue\u548creturn\u8bed\u53e5\u6765\u5b9e\u73b0\u63a7\u5236\u8bed\u53e5\u7684\u8df3\u8f6c\u548c\u4e2d\u65ad\u3002\u5728\u67d0\u4e2a\u5faa\u73af\u6267\u884c\u5230\u67d0\u4e00\u6b65\u7684\u65f6\u5019\u5c31\u7ed3\u675f\u3002<\/p>\n<p>1\uff09break\u8bed\u53e5<\/p>\n<pre><code class=\"prettyprint\" > \u8868\u793a\u7ed3\u675f\u5f53\u524d\u6240\u5728\u7684\u5faa\u73af.\n\n \u6ce8\u610f\uff1abreak\u4e4b\u540e\u7684\u8bed\u53e5,\u6267\u884c\u4e0d\u5230,\u82e5\u7f16\u5199\u4e86,\u5219\u8bed\u6cd5\u62a5\u9519.<\/code><\/pre>\n<p>2\uff09continue\u8bed\u53e5:<\/p>\n<pre><code class=\"prettyprint\" > \u8868\u793a\u8df3\u8fc7\u5f53\u524d\u5faa\u73af,\u7ee7\u800c\u8fdb\u884c\u4e0b\u4e00\u6b21\u5faa\u73af.\n\n \u6ce8\u610f\uff1acontinue\u4e4b\u540e\u7684\u8bed\u53e5,\u6267\u884c\u4e0d\u5230,\u82e5\u7f16\u5199\u4e86,\u5219\u8bed\u6cd5\u62a5\u9519.<\/code><\/pre>\n<p>3\uff09return\u8bed\u53e5:<\/p>\n<pre><code class=\"prettyprint\" > \u8868\u793a\u7ed3\u675f\u5faa\u73af\u6240\u5728\u7684\u65b9\u6cd5\uff0c\u65b9\u6cd5\u90fd\u7ed3\u675f\u4e86\uff0c\u5faa\u73af\u7ed3\u6784\u81ea\u7136\u4e5f\u5c31\u7ed3\u675f\u4e86\u3002<\/code><\/pre>\n<p><strong>break ,continue ,return<\/strong> \u7684\u533a\u522b\u53ca\u4f5c\u7528<\/p>\n<p>break \u8df3\u51fa\u603b\u4e0a\u4e00\u5c42\u5faa\u73af\uff0c\u4e0d\u518d\u6267\u884c\u5faa\u73af(\u7ed3\u675f\u5f53\u524d\u7684\u5faa\u73af\u4f53)<\/p>\n<p>continue \u8df3\u51fa\u672c\u6b21\u5faa\u73af\uff0c\u7ee7\u7eed\u6267\u884c\u4e0b\u6b21\u5faa\u73af(\u7ed3\u675f\u6b63\u5728\u6267\u884c\u7684\u5faa\u73af \u8fdb\u5165\u4e0b\u4e00\u4e2a\u5faa\u73af\u6761\u4ef6)<\/p>\n<p>return \u7a0b\u5e8f\u8fd4\u56de\uff0c\u4e0d\u518d\u6267\u884c\u4e0b\u9762\u7684\u4ee3\u7801(\u7ed3\u675f\u5f53\u524d\u7684\u65b9\u6cd5 \u76f4\u63a5\u8fd4\u56de)<\/p>\n<hr \/>\n<p><strong>END<\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u6570\u636e\u7c7b\u578b 1. JAVA\u6709\u54ea\u4e9b\u6570\u636e\u7c7b\u578b \u5b9a\u4e49\uff1aJava\u8bed\u8a00\u662f\u5f3a\u7c7b\u578b\u8bed\u8a00\uff0c\u6bcf\u4e00\u79cd\u6570\u636e\u90fd\u6709\u660e\u5177\u4f53\u7684\u6570\u636e\u7c7b\u578b\uff0c\u800c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":164,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,5],"tags":[],"_links":{"self":[{"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/posts\/154"}],"collection":[{"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ericw.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=154"}],"version-history":[{"count":5,"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/posts\/154\/revisions"}],"predecessor-version":[{"id":163,"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/posts\/154\/revisions\/163"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/ericw.top\/index.php?rest_route=\/wp\/v2\/media\/164"}],"wp:attachment":[{"href":"http:\/\/ericw.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ericw.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ericw.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}