{"id":5679,"date":"2024-08-22T17:15:40","date_gmt":"2024-08-22T08:15:40","guid":{"rendered":"https:\/\/techfun.cc\/?p=5679"},"modified":"2025-06-10T11:24:21","modified_gmt":"2025-06-10T02:24:21","slug":"java_base_basic_java_2","status":"publish","type":"post","link":"https:\/\/techfun.cc\/java-base\/java_base_basic_java_2.html","title":{"rendered":"Java\u306e\u57fa\u672c\uff08\u5f8c\u7de8\uff09"},"content":{"rendered":"<h3 class=\"Heading Title Title--m\" id=\"Bookmark-1\"><span class=\"Num\">1.<\/span>\u672c\u7ae0\u3067\u306e\u5b66\u7fd2\u9805\u76ee<\/h3>\n<p>Java\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8a18\u8ff0\u3059\u308b\u4e0a\u3067\u6700\u4f4e\u9650\u5fc5\u8981\u306a\u57fa\u672c\u30eb\u30fc\u30eb\u3068\u57fa\u672c\u6587\u6cd5\u3092\u5b66\u7fd2\u3059\u308b\u300cJava\u306e\u57fa\u672c\u300d\u306e\u5f8c\u7de8\u3067\u3059\u3002<br \/>\n<a href=\"https:\/\/techfun.cc\/java-base\/java_base_basic_java_1.html\">\u524d\u7de8<\/a>\u3067\u306f\u69cb\u6587\u30eb\u30fc\u30eb\u3084\u30c7\u30fc\u30bf\u578b\u3001\u6f14\u7b97\u5b50\u306a\u3069\u3092\u6271\u3044\u307e\u3057\u305f\u304c\u3001\u5f8c\u7de8\u3067\u306f\u6761\u4ef6\u51e6\u7406\u3084\u7e70\u308a\u8fd4\u3057\u3092\u6271\u3044\u307e\u3059\u3002<\/p>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-2\"><span class=\"Num\">2.<\/span>\u672c\u7ae0\u306e\u8b1b\u7fa9<\/h3>\n<p>\u672c\u7ae0\u3067\u5b66\u7fd2\u3059\u308b\u5185\u5bb9\u3092\u52d5\u753b\u3068\u3057\u3066\u307e\u3068\u3081\u305f\u3082\u306e\u3067\u3059\u3002\u4e00\u901a\u308a\u898b\u7d42\u308f\u3063\u305f\u5f8c\u3067\u3001\u5b66\u7fd2\u306b\u5165\u308b\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"Video-block\">\n<div class=\"Video-block__title\">\u8b1b\u7fa9:Java\u306e\u57fa\u672c\u2461<\/div>\n<div class=\"Video-block__video Youtube\">\n\t\t<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube-nocookie.com\/embed\/mVO61BxIKAQ?si=NlakXHgSiAqbv0nR&#038;rel=0\"\n\t\t\ttitle=\"YouTube video player\" frameborder=\"0\"\n\t\t\tallow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\"\n\t\t\treferrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n\t<\/div>\n<\/div>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-3\"><span class=\"Num\">3.<\/span>\u6761\u4ef6\u5206\u5c90\u51e6\u7406<\/h3>\n<p>\u6761\u4ef6\u5206\u5c90\u51e6\u7406\u3068\u306f\u3001\u51e6\u7406\u3092\u3042\u308b\u6761\u4ef6\u3067\u5206\u5c90\u3055\u305b\u305f\u3044\u5834\u5408\u306b\u4f7f\u3046\u6587\u6cd5\u3067\u3059\u3002<br \/>\n\u901a\u5e38\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u3001\u4e0a\u304b\u3089\u9806\u306b\u5b9f\u884c\u3055\u308c\u307e\u3059\u304c\u3001\u300c\u3082\u3057\u30fb\u30fb\u30fb\u306a\u3089\u3070\u3001A\u306e\u51e6\u7406\u3092\u3059\u308b\u300d\u307e\u305f\u306f\u300cA\u306e\u51e6\u7406\u3092\u3057\u306a\u3044\u300d\u3068\u3044\u3046\u3088\u3046\u306b\u3001\u51e6\u7406\u306e\u6d41\u308c\u3092\u5206\u5c90\u3055\u305b\u305f\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u300c\u3082\u3057\u30fb\u30fb\u30fb\u306a\u3089\u3070\u3001A\u306e\u51e6\u7406\u3092\u3059\u308b\u300d\u305d\u3057\u3066\u300c\u3082\u3057\u30fb\u30fb\u30fb\u306a\u3089\u3070\u3001B\u306e\u51e6\u7406\u3092\u3059\u308b\u300d\u3068\u51e6\u7406\u3092\u8907\u6570\u306b\u5206\u5c90\u3055\u305b\u305f\u3044\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002\u3053\u3093\u306a\u3068\u304d\u306b\u4f7f\u3046\u306e\u304c\u3001\u6761\u4ef6\u5206\u5c90\u51e6\u7406\u3067\u3059\u3002<br \/>\n\u6761\u4ef6\u5206\u5c90\u51e6\u7406\u306f\u3001\u5927\u5909\u3088\u304f\u4f7f\u3046\u69cb\u6587\u3067\u3059\u306e\u3067\u3001\u3057\u3063\u304b\u308a\u3068\u7406\u89e3\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-3-1\"><span class=\"Num\">3.1.<\/span>if\u6587<\/h4>\n<p>\u6761\u4ef6\u5206\u5c90\u51e6\u7406\u3067\u3001\u983b\u7e41\u306b\u5229\u7528\u3055\u308c\u308b\u6587\u6cd5\u304c\u3001if\u6587\u3067\u3059\u3002<br \/>\nif\u6587\u306f\u3001\u300c\u3082\u3057\u3001\u6761\u4ef6x\u306b\u3042\u3066\u306f\u307e\u308b\u306e\u3067\u3042\u308c\u3070\u3001A\u306e\u51e6\u7406\u3092\u3059\u308b\u300d\u3068\u3044\u3046\u3088\u3046\u306b\u51e6\u7406\u3092\u5206\u5c90\u3055\u305b\u307e\u3059\u3002<br \/>\n\u305d\u306e\u6761\u4ef6x\u3092\u8a18\u8ff0\u3059\u308b\u969b\u306b\u3001\u6bd4\u8f03\u6f14\u7b97\u5b50\u3084\u8ad6\u7406\u6f14\u7b97\u5b50\u306a\u3069\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<br \/>\n\u6761\u4ef6x\u306e\u7d50\u679c\u304ctrue\uff08\u3042\u3066\u306f\u307e\u308b\uff09\u306e\u5834\u5408\u306f\u3001A\u306e\u51e6\u7406\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>if\u6587\u306e\u8a18\u8ff0\u30d1\u30bf\u30fc\u30f3\u306f\u3001\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u9806\u756a\u306b\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h5 class=\"Heading Title Title--xs\" id=\"Bookmark-3-1-1\"><span class=\"Num\">3.1.1.<\/span>if\u6587<\/h5>\n<p>\u300c\u3082\u3057\u3001\u6761\u4ef6x\u304ctrue\u306e\u5834\u5408\u3001\u51e6\u7406A\u3092\u5b9f\u884c\u300d\u306eif\u6587\u306e\u66f8\u5f0f\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>if (\u6761\u4ef6x) {\r\n\t\u6761\u4ef6x\u304ctrue\u306e\u5834\u5408\u306b\u5b9f\u884c\u3059\u308b\u51e6\u7406A\r\n}<\/code><\/pre>\n<p>\u6761\u4ef6x\u304ctrue\u306e\u5834\u5408\u3001\u51e6\u7406A\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u304c\u3001\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u3001\u51e6\u7406A\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p><a class=\"Ext Image-link\" href=\"https:\/\/techfun.cc\/wp-content\/uploads\/2024\/06\/if.png\"><br \/>\n\t<img decoding=\"async\" src=\"https:\/\/techfun.cc\/wp-content\/uploads\/2024\/06\/if.png\" alt=\"if\"><br \/>\n<\/a><\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u66f8\u304f\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"Pre-title\">If1.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>public class If1 {\r\n\tpublic static void main(String[] args) {\r\n\t\t\/\/ int\u578b\u5909\u6570x\u306e\u5ba3\u8a00\u306810\u306e\u4ee3\u5165\r\n\t\tint x = 10;\r\n\r\n\t\t\/\/ int\u578b\u5909\u6570y\u306e\u5ba3\u8a00\u306810\u306e\u4ee3\u5165\r\n\t\tint y = 10;\r\n\r\n\t\t\/\/ x\u3068y\u304c\u7b49\u3057\u3044\u304b\u5426\u304b\u3092\u5224\u5b9a\r\n\t\tif (x == y) {\r\n\t\t\t\/\/ x\u3068y\u304c\u7b49\u3057\u3044\uff08true\u3067\u3042\u308b\uff09\u305f\u3081\u3001\r\n\t\t\t\/\/\u300cJava\u306f\u3001\u697d\u3057\u3044\u3067\u3059\uff01\u300d\u3092\u51fa\u529b\r\n\t\t\tSystem.out.println(\"Java\u306f\u3001\u697d\u3057\u3044\u3067\u3059\uff01\");\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\u3082\u3046\u4e00\u3064\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002\u4eca\u5ea6\u306f\u3001\u6761\u4ef6\u306e\u7d50\u679c\u304cfalse\u306e\u5834\u5408\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002<\/p>\n<div class=\"Pre-title\">If2.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>public class If2 {\r\n\tpublic static void main(String[] args) { \/\/ \u30e1\u30a4\u30f3\u30e1\u30bd\u30c3\u30c9\uff08\u5f8c\u3067\u5b66\u7fd2\u3057\u307e\u3059\uff09\r\n\t\t\/\/ int\u578b\u5909\u6570x\u306e\u5ba3\u8a00\u306810\u306e\u4ee3\u5165\r\n\t\tint x = 10;\r\n\r\n\t\t\/\/ int\u578b\u5909\u6570y\u306e\u5ba3\u8a00\u306810\u306e\u4ee3\u5165\r\n\t\tint y = 10;\r\n\r\n\t\t\/\/ x\u306fy\u3088\u308a\u5c0f\u3055\u3044\u304b\u5426\u304b\u3092\u5224\u5b9a\r\n\t\tif (x &lt; y) {\r\n\t\t\t\/\/ x\u306fy\u3088\u308a\u5c0f\u3055\u304f\u306a\u3044\uff08false\u3067\u3042\u308b\uff09\u305f\u3081\u3001\r\n\t\t\t\/\/\u300cJava\u306f\u3001\u697d\u3057\u3044\u3067\u3059\uff01\u300d\u3092\u51fa\u529b\u3057\u306a\u3044\r\n\t\t\tSystem.out.println(\"Java\u306f\u3001\u697d\u3057\u3044\u3067\u3059\uff01\");\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>if\u6587\u306b\u304a\u3044\u3066\u3001\u6761\u4ef6\u5206\u5c90\u306e\u6761\u4ef6\u3068\u3057\u3066\u8a18\u8ff0\u3059\u308b\u5f0f\u306e\u3053\u3068\u3092\u3001\u6761\u4ef6\u5f0f\u3068\u547c\u3073\u307e\u3059\u3002<br \/>\n\u6761\u4ef6\u5f0f\u306f\u3001<span class=\"Text-highlight\">\u7d50\u679c\u304cboolean\u578b\u306etrue\u304bfalse\u3067\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093\u3002<\/span><br \/>\n\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u3082\u306e\u3092\u3001if\u6587\u306e\u6761\u4ef6\u5f0f\u3067\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul class=\"Base-list\">\n<li class=\"Base-list__child\">\u95a2\u4fc2\u6f14\u7b97\u5b50<\/li>\n<li class=\"Base-list__child\">\u8ad6\u7406\u6f14\u7b97\u5b50<\/li>\n<li class=\"Base-list__child\">boolean\u578b\u306e\u5909\u6570\u3001\u307e\u305f\u306ftrue\u3001false<\/li>\n<\/ul>\n<h5 class=\"Heading Title Title--xs\" id=\"Bookmark-3-1-2\"><span class=\"Num\">3.1.2.<\/span>if\u30fb\u30fb\u30fbelse\u6587<\/h5>\n<p>\u6b21\u306b\u8aac\u660e\u3059\u308bif\u30fb\u30fb\u30fbelse\u6587\u306f\u3001\u300c\u3082\u3057\u3001\u6761\u4ef6x\u304ctrue\u306e\u5834\u5408\u3001\u51e6\u7406A\u3092\u5b9f\u884c\u3057\u3001false\u306e\u5834\u5408\u3001\u51e6\u7406B\u3092\u5b9f\u884c\u300d\u3068\u3044\u3046\u6761\u4ef6\u5206\u5c90\u3092\u884c\u3044\u305f\u3044\u5834\u5408\u306b\u4f7f\u7528\u3059\u308b\u6587\u6cd5\u3067\u3059\u3002<br \/>\nif\u30fb\u30fb\u30fbelse\u6587\u306e\u66f8\u5f0f\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>if (\u6761\u4ef6x) {\r\n\t\u6761\u4ef6x\u304ctrue\u306e\u5834\u5408\u306b\u5b9f\u884c\u3059\u308b\u51e6\u7406A\r\n} else {\r\n\t\u6761\u4ef6x\u304cfalse\u306e\u5834\u5408\u306b\u5b9f\u884c\u3059\u308b\u51e6\u7406B\r\n}<\/code><\/pre>\n<p>\u6761\u4ef6x\u304ctrue\u306e\u5834\u5408\u3001\u51e6\u7406A\u304c\u5b9f\u884c\u3055\u308c\u3001\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u306f\u3001\u51e6\u7406B\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<br \/>\n\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u66f8\u304f\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"Pre-title\">If3.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>public class If3 {\r\n\tpublic static void main(String[] args) {\r\n\t\t\/\/ int\u578b\u5909\u6570x\u306e\u5ba3\u8a00\u306870\u306e\u4ee3\u5165\uff08\u5408\u683c\u70b9\uff09\r\n\t\tint x = 70;\r\n\r\n\t\t\/\/ int\u578b\u5909\u6570y\u306e\u5ba3\u8a00\u306880\u306e\u4ee3\u5165\uff08\u30c6\u30b9\u30c8\u306e\u70b9\uff09\r\n\t\tint y = 80;\r\n\r\n\t\t\/\/ y\uff08\u30c6\u30b9\u30c8\u306e\u70b9\uff09\u304cx\uff08\u5408\u683c\u70b9\uff09\u3088\u308a\u4e0a\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\tif (x &lt;= y) {\r\n\t\t\tSystem.out.println(\"\u30c6\u30b9\u30c8\u306f\u5408\u683c\uff01\");\r\n\r\n\t\t} else {\r\n\t\t\tSystem.out.println(\"\u30c6\u30b9\u30c8\u306f\u4e0d\u5408\u683c\u30fb\u30fb\u30fb\");\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5909\u6570y\u306e\u5024\u3092\u8272\u3005\u3068\u5909\u66f4\u3057\u3066\u3001\u6761\u4ef6\u5206\u5c90\u306e\u7d50\u679c\u306e\u9055\u3044\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h5 class=\"Heading Title Title--xs\" id=\"Bookmark-3-1-3\"><span class=\"Num\">3.1.3.<\/span>if\u30fb\u30fb\u30fbelse if\u6587<\/h5>\n<p>if\u6587\u306e\u6700\u5f8c\u306f\u3001if\u30fb\u30fb\u30fbelse<br \/>\nif\u6587\u3067\u3059\u3002\u300c\u3082\u3057\u3001\u6761\u4ef6x\u304ctrue\u306e\u5834\u5408\u3001\u51e6\u7406A\u3092\u5b9f\u884c\u3057\u3001\u305d\u3046\u3067\u306f\u306a\u3044\u5834\u5408\u3067\u3001\u3082\u3057\u3001\u6761\u4ef6y\u304ctrue\u306e\u5834\u5408\u3001\u300c\u51e6\u7406B\u3092\u5b9f\u884c\u300d\u3068\u3044\u3046\u6761\u4ef6\u5206\u5c90\u3092\u884c\u3044\u305f\u3044\u5834\u5408\u306b\u4f7f\u7528\u3059\u308b\u6587\u6cd5\u3067\u3059\u3002<br \/>\nif\u30fb\u30fb\u30fbelse if\u6587\u306e\u66f8\u5f0f\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>if (\u6761\u4ef6x) {\r\n\t\u6761\u4ef6x\u304ctrue\u306e\u5834\u5408\u306b\u5b9f\u884c\u3059\u308b\u51e6\u7406A\r\n} else if (\u6761\u4ef6y) {\r\n\t\u6761\u4ef6y\u304ctrue\u306e\u5834\u5408\u306b\u5b9f\u884c\u3059\u308b\u51e6\u7406B\r\n}<\/code><\/pre>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u66f8\u304f\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"Pre-title\">If4.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>public class If4 {\r\n\tpublic static void main(String[] args) {\r\n\t\tint x = 90; \/\/ int\u578b\u5909\u6570x\u306e\u5ba3\u8a00\u306890\u306e\u4ee3\u5165\uff08\u5224\u5b9aA\uff09\r\n\t\tint y = 70; \/\/ int\u578b\u5909\u6570y\u306e\u5ba3\u8a00\u306870\u306e\u4ee3\u5165\uff08\u5224\u5b9aB\uff09\r\n\t\tint z = 60; \/\/ int\u578b\u5909\u6570z\u306e\u5ba3\u8a00\u306860\u306e\u4ee3\u5165\uff08\u5224\u5b9aC\uff09\r\n\t\tint i = 65; \/\/ int\u578b\u5909\u6570i\u306e\u5ba3\u8a00\u306865\u306e\u4ee3\u5165\uff08\u30c6\u30b9\u30c8\u306e\u70b9\uff09\r\n\r\n\t\tif (i &gt;= x) { \/\/ i\uff08\u30c6\u30b9\u30c8\u306e\u70b9\uff09\u304cx\uff08\u5224\u5b9aA\uff09\u4ee5\u4e0a\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\tSystem.out.println(\"\u5224\u5b9aA\uff01\");\r\n\r\n\t\t} else if (i &gt;= y) { \/\/ i\uff08\u30c6\u30b9\u30c8\u306e\u70b9\uff09\u304cy\uff08\u5224\u5b9aB\uff09\u4ee5\u4e0a\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\tSystem.out.println(\"\u5224\u5b9aB\uff01\");\r\n\r\n\t\t} else if (i &gt;= z) { \/\/ i\uff08\u30c6\u30b9\u30c8\u306e\u70b9\uff09\u304cz\uff08\u5224\u5b9aC\uff09\u4ee5\u4e0a\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\tSystem.out.println(\"\u5224\u5b9aC\uff01\");\r\n\r\n\t\t} else { \/\/ i\uff08\u30c6\u30b9\u30c8\u306e\u70b9\uff09\u304c\u4e0d\u5408\u683c\u3067\u3042\u308b\u5834\u5408\u306e\u5224\u5b9a\r\n\t\t\tSystem.out.println(\"\u30c6\u30b9\u30c8\u306f\u4e0d\u5408\u683c\u30fb\u30fb\u30fb\");\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30b5\u30f3\u30d7\u30eb\u3082\u3001\u5909\u6570i\u306e\u5024\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u3001\u51fa\u529b\u7d50\u679c\u306b\u9055\u3044\u304c\u51fa\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\u307e\u305f\u3001\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u3067\u66f8\u304b\u308c\u3066\u3044\u308b\u3068\u304a\u308a\u3001if\u30fb\u30fb\u30fbelse if\u30fb\u30fb\u30fb\u306e\u6700\u5f8c\u306b\u3001else\u6587\u3092\u66f8\u304f\u3068\u3001\u305d\u308c\u307e\u3067\u306e\u6761\u4ef6\u3067true\u306b\u306a\u3089\u306a\u304b\u3063\u305f\u5834\u5408\u306f\u3001else\u6587\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>if\u6587\u306e\u8aac\u660e\u306f\u3001\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-3-2\"><span class=\"Num\">3.2.<\/span>switch\u6587<\/h4>\n<p>\u6761\u4ef6\u5206\u5c90\u51e6\u7406\u306e\u4e00\u3064\u3068\u3057\u3066\u3001if\u6587\u306e\u4ed6\u306bswitch\u6587\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\nswitch\u6587\u306f\u3001\u300c\u3042\u308b\u5909\u6570x\u304c\u50241\u306a\u3089\u3070\u3001\u51e6\u7406A\u3001\u50242\u306a\u3089\u3070\u3001\u51e6\u7406B\u3001\u50243\u306a\u3089\u3070\u3001\u51e6\u7406C\u30fb\u30fb\u30fb\u300d\u3068\u3044\u3046\u3088\u3046\u306b\u51e6\u7406\u3092\u5206\u5c90\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\nswitch\u6587\u306e\u66f8\u5f0f\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>switch(\u5909\u6570\u307e\u305f\u306f\u5f0f){\r\n\tcase \u50241 :\r\n\t\t\u5909\u6570\u307e\u305f\u306f\u5f0f\u306e\u5024\u304c\u50241\u306e\u5834\u5408\u306b\u5b9f\u884c\u3059\u308b\u51e6\u7406A\r\n\t\tbreak;\r\n\tcase \u50242 :\r\n\t\t\u5909\u6570\u307e\u305f\u306f\u5f0f\u306e\u5024\u304c\u50242\u306e\u5834\u5408\u306b\u5b9f\u884c\u3059\u308b\u51e6\u7406B\r\n\t\tbreak;\r\n\tcase \u50243 :\r\n\t\t\u5909\u6570\u307e\u305f\u306f\u5f0f\u306e\u5024\u304c\u50243\u306e\u5834\u5408\u306b\u5b9f\u884c\u3059\u308b\u51e6\u7406C\r\n\t\tbreak;\r\n\tdefault :\r\n\t\t\u5909\u6570\u307e\u305f\u306f\u5f0f\u306e\u5024\u304c\u50241\u304b\u3089\u50243\u4ee5\u5916\u306e\u5834\u5408\u306b\u5b9f\u884c\u3059\u308b\u51e6\u7406D\r\n}<\/code><\/pre>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u66f8\u304f\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"Pre-title\">Switch1.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>public class Switch1 {\r\n\tpublic static void main(String[] args) {\r\n\t\tint i = 4; \/\/ int\u578b\u5909\u6570i\u306e\u5ba3\u8a00\u30684\u306e\u4ee3\u5165\uff08\u73fe\u5728\u306e\u6708\uff09\r\n\r\n\t\tswitch (i) {\r\n\t\t\tcase 1: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c1\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u51ac\u3067\u3059\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c2\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u3042\u3068\u5c11\u3057\u306e\u9593\u306f\u51ac\u3067\u3059\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c3\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u3082\u3046\u6625\u3067\u3059\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 4: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c4\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u6625\u721b\u6f2b\u3067\u3059\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 5: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c5\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u3082\u3046\u3059\u3050\u590f\u3067\u3059\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 6: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c6\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u521d\u590f\u3067\u3059\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 7: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c7\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u590f\u3067\u3059\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 8: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c8\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u590f\u771f\u3063\u76db\u308a\u3067\u3059\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 9: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c9\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u79cb\u306b\u306a\u308a\u307e\u3057\u305f\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 10: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c10\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u79cb\u3067\u3059\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 11: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c11\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u6669\u79cb\u3067\u3059\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 12: \/\/ i\uff08\u73fe\u5728\u306e\u6708\uff09\u304c12\u304b\u5426\u304b\u306e\u5224\u5b9a\r\n\t\t\t\tSystem.out.println(\"\u51ac\u306b\u306a\u308a\u307e\u3057\u305f\");\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\tSystem.out.println(\"\u305d\u3093\u306a\u6708\u306f\u3042\u308a\u307e\u305b\u3093\uff01\");\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5909\u6570i\u3092\u3001\u8272\u3005\u3068\u5909\u66f4\u3057\u3066\u3001\u51fa\u529b\u7d50\u679c\u306e\u9055\u3044\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\nswitch\u6587\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u3001break\u3092\u5165\u308c\u308b\u3053\u3068\u3067\u3059\u3002<br \/>\n\u8a66\u3057\u306b\u4e0a\u8a18\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u300cbreak;\u300d\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\uff08\u524d\u306b\u300c\/\/\u300d\u3092\u5165\u308c\u308b\uff09\u3057\u3066\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u52d5\u4f5c\u3055\u305b\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002<br \/>\ncase\u51e6\u7406\u306e\u4e2d\u306b\u3001break\u3092\u66f8\u304b\u306a\u3044\u3068\u3001\u5224\u5b9a\u304ctrue\u3068\u306a\u308bcase\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u305f\u5f8c\u3001\u305d\u308c\u4ee5\u964d\u306ecase\u306e\u51e6\u7406\u3082\u5224\u5b9a\u306b\u95a2\u4fc2\u306a\u304f\u5168\u3066\u5b9f\u884c\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\n\u901a\u5e38\u306f\u3001break\u3092\u66f8\u304f\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u3069\u3053\u304b\u306ecase\u51e6\u7406\u3067true\u3068\u306a\u308a\u3001\u305d\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u305f\u3089\u3001\u305d\u308c\u4ee5\u964d\u306ecase\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u306a\u3044\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0a\u3067\u3001\u6761\u4ef6\u5206\u5c90\u51e6\u7406\u306e\u8aac\u660e\u306f\u7d42\u308f\u308a\u3067\u3059\u3002if\u6587\u3001switch\u6587\u306f\u3001\u305d\u306e\u3068\u304d\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u4ed5\u69d8\u306b\u5fdc\u3058\u3066\u3001\u4f7f\u3044\u5206\u3051\u307e\u3059\u3002<\/p>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-4\"><span class=\"Num\">4.<\/span>\u7df4\u7fd2\u554f\u984c3<\/h3>\n<p>\u6761\u4ef6\u5206\u5c90\u306e\u7df4\u7fd2\u554f\u984c\u3067\u3059\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-4-1\"><span class=\"Num\">4.1.<\/span>\u554f\u984c1<\/h4>\n<p>if\u30fb\u30fb\u30fbelse\u6587\u3092\u5229\u7528\u3057\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>int\u578b\u306e\u5909\u6570age\u3092\u5ba3\u8a00\u3057\u3001\u81ea\u5206\u306e\u5e74\u9f62\u3092\u4ee3\u5165\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\nif\u6587\u3092\u4f7f\u7528\u3057\u3066\u3001\u5909\u6570age\u304c20\u4ee5\u4e0a\u306e\u5834\u5408\u3001\u300c\u7acb\u6d3e\u306a\u5927\u4eba\u3067\u3059\u3002\u300d\u304c\u753b\u9762\u306b\u8868\u793a\u3055\u308c\u3001<br \/>\n\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u3001\u300c\u307e\u3060\u307e\u3060\u5b50\u4f9b\u3067\u3059\u3002\u300d\u304c\u753b\u9762\u306b\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"Answer-block\">\n\t<input class=\"SW\" type=\"checkbox\" id=\"Answer-content-1\"><label for=\"Answer-content-1\" class=\"Answer-SW\"><span\n\t\t\tclass=\"Google-icon Google-icon--arrow-single-gray\"><\/span>\u89e3\u7b54\u3092\u8868\u793a\u3059\u308b<\/label><\/p>\n<div class=\"Answer-content\">\n<div class=\"Pre-title\">Mondai11_1.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>\/**\r\n * \u51e6\u7406\u6982\u8981\uff1aif\u30fb\u30fbelse\u6587\u51e6\u7406(\u5909\u6570age\u304c20\u4ee5\u4e0a\u306e\u5834\u5408\u3068\u305d\u308c\u4ee5\u5916\u306e\u5834\u5408\u3067\u6761\u4ef6\u5206\u5c90)\r\n *\/\r\npublic class Mondai11_1 {\r\n\tpublic static void main(String[] args) {\r\n\t\t\/\/ int\u578b\u5909\u6570age\u306e\u5ba3\u8a00\u3068\u5024\u306e\u4ee3\u5165\r\n\t\tint age = 23;\r\n\r\n\t\t\/\/ if\u6587\u306b\u3088\u308b\u6761\u4ef6\u5206\u5c90\r\n\t\tif (age &gt;= 20) { \/\/ \u5909\u6570age\u304c20\u4ee5\u4e0a\u306e\u3068\u304d\u306e\u51e6\u7406\r\n\t\t\tSystem.out.println(\"\u7acb\u6d3e\u306a\u5927\u4eba\u3067\u3059\u3002\");\r\n\t\t} else { \/\/ \u5909\u6570age\u304c20\u672a\u6e80\u306e\u3068\u304d\u306e\u51e6\u7406\r\n\t\t\tSystem.out.println(\"\u307e\u3060\u307e\u3060\u5b50\u4f9b\u3067\u3059\u3002\");\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\t\tif\u30fb\u30fbelse\u6587\u306e\u554f\u984c\u3067\u3059\u3002<br \/>\n\t\t\u95a2\u4fc2\u6f14\u7b97\u5b50\u3092\u4f7f\u7528\u3057\u3066\u3001\u300cage &gt;= 20\u300d\u3068\u3044\u3046\u6761\u4ef6\u3067\u5224\u5b9a\u3092\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\t\tif\u6587\u306e\u6761\u4ef6\u5f0f\u306e\u7d50\u679c\u304ctrue\u306e\u5834\u5408\u3001\u300c\u7acb\u6d3e\u306a\u5927\u4eba\u3067\u3059\u3002\u300d\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<br \/>\n\t\t\u307e\u305f\u3001if\u6587\u306e\u6761\u4ef6\u5f0f\u306b\u8a72\u5f53\u3057\u306a\u3044\u5834\u5408\u3001else\u6587\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u3001\u300c\u307e\u3060\u307e\u3060\u5b50\u4f9b\u3067\u3059\u3002\u300d\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002\n\t<\/p><\/div>\n<\/div>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-4-2\"><span class=\"Num\">4.2.<\/span>\u554f\u984c2<\/h4>\n<p>if\u30fb\u30fbelse if\u6587\u3092\u5229\u7528\u3057\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<ol class=\"Base-list Base-list--ol\">\n<li class=\"Base-list__child\">int\u578b\u5909\u6570hour\u3092\u5ba3\u8a00\u3057\u307e\u3059\u3002<\/li>\n<li class=\"Base-list__child\">\u5909\u6570hour\u306b\u73fe\u5728\u306e\u6642\u9593\u3092\u4ee3\u5165\u3057\u307e\u3059\u3002<\/li>\n<li class=\"Base-list__child\">if\u30fb\u30fbelse if\u6587\u3092\u4f7f\u7528\u3057\u3066\u3001\u5909\u6570hour\u304c\u4ee5\u4e0b\u306e\u305d\u308c\u305e\u308c\u306e\u6761\u4ef6\u306b\u5408\u81f4\u3059\u308b\u5834\u5408\u3001\u8a72\u5f53\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u753b\u9762\u51fa\u529b\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\n<ul class=\"Base-list\">\n<li class=\"Base-list__child\">8\u304b\u308911\u307e\u3067\uff1a\u300c\u304a\u306f\u3088\u3046\u3054\u3056\u3044\u307e\u3059\uff01\u4eca\u65e5\u3082\u4e00\u65e5\u9811\u5f35\u308a\u307e\u3057\u3087\u3046\u3002\u300d<\/li>\n<li class=\"Base-list__child\">12\u304b\u308915\u307e\u3067\uff1a\u300c\u3053\u3093\u306b\u3061\u306f\u3002\u5c45\u7720\u308a\u3057\u306a\u3044\u3088\u3046\u306b\uff01\u300d<\/li>\n<li class=\"Base-list__child\">16\u304b\u308918\u307e\u3067\uff1a\u300c\u3042\u3068\u5c11\u3057\u9811\u5f35\u308a\u307e\u3057\u3087\u3046\u3002\u300d<\/li>\n<li class=\"Base-list__child\">19\u304b\u308921\u307e\u3067\uff1a\u300c\u304a\u75b2\u308c\u69d8\u3002\u307e\u305f\u660e\u65e5\uff01\u300d<\/li>\n<li class=\"Base-list__child\">\u305d\u308c\u4ee5\u5916\uff1a\u300c\u9811\u5f35\u308a\u904e\u304e\u3067\u3059\u3002\u4f11\u307f\u307e\u3057\u3087\u3046\u3002\u300d<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><span class=\"Text-highlight\">\u203b\u3053\u306e\u554f\u984c\u306e\u89e3\u7b54\u306f\u63b2\u8f09\u3057\u3066\u304a\u308a\u307e\u305b\u3093\u3002<span class=\"Post-link\" >Tech Fun IT\u30b9\u30af\u30fc\u30eb\u306eJava\u7814\u4fee<\/span>\u3067\u306f\u3001\u8b1b\u5e2b\u304c\u4e01\u5be7\u306b\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/span><br \/>\n<span class=\"Text-red-bold\">\u73fe\u5728Tech Fun IT\u30b9\u30af\u30fc\u30eb\u3067\u306f\u3001\u65b0\u898f\u53d7\u8b1b\u8005\u306e\u52df\u96c6\u306f\u884c\u306a\u3063\u3066\u304a\u308a\u307e\u305b\u3093\u3002<\/span><\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-4-3\"><span class=\"Num\">4.3.<\/span>\u554f\u984c3<\/h4>\n<p>switch\u6587\u3092\u5229\u7528\u3057\u3066\u554f\u984c2\u3068\u540c\u69d8\u306e\u6761\u4ef6\u5206\u5c90\u3068\u306a\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"Answer-block\">\n\t<input class=\"SW\" type=\"checkbox\" id=\"Answer-content-2\"><label for=\"Answer-content-2\" class=\"Answer-SW\"><span\n\t\t\tclass=\"Google-icon Google-icon--arrow-single-gray\"><\/span>\u89e3\u7b54\u3092\u8868\u793a\u3059\u308b<\/label><\/p>\n<div class=\"Answer-content\">\n<div class=\"Pre-title\">Mondai11_3.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>\/**\r\n * \u51e6\u7406\u6982\u8981\uff1aswitch\u6587\u3092\u4f7f\u7528\u3057\u305f\u6761\u4ef6\u5206\u5c90\u51e6\u7406(\u5909\u6570hour\u3092\u6761\u4ef6\u306b\u5404\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u51fa\u529b)\r\n *\/\r\npublic class Mondai11_3 {\r\n\tpublic static void main(String[] args) {\r\n\t\t\/\/ int\u578b\u5909\u6570hour\u306e\u5ba3\u8a00\u3068\u73fe\u5728\u306e\u6642\u9593\u3092\u8868\u3059\u5024\u306e\u4ee3\u5165\r\n\t\tint hour = 17;\r\n\r\n\t\t\/\/ \u5909\u6570hour\u304c\u305d\u308c\u305e\u308c\u306e\u6761\u4ef6\u306b\u5408\u81f4\u3059\u308b\u5834\u5408\u3001\u8a72\u5f53\u30e1\u30c3\u30bb\u30fc\u30b8\u51fa\u529b\r\n\t\tswitch (hour) {\r\n\t\t\tcase 8:  \/\/ hour\u304c8\u6642\u304b\u308911\u6642\u306e\u5834\u5408\r\n\t\t\tcase 9:\r\n\t\t\tcase 10:\r\n\t\t\tcase 11:\r\n\t\t\t\tSystem.out.println(\"\u304a\u306f\u3088\u3046\u3054\u3056\u3044\u307e\u3059\uff01\u4eca\u65e5\u3082\u4e00\u65e5\u9811\u5f35\u308a\u307e\u3057\u3087\u3046\u3002\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 12: \/\/ hour\u304c12\u6642\u304b\u308915\u6642\u306e\u5834\u5408\r\n\t\t\tcase 13:\r\n\t\t\tcase 14:\r\n\t\t\tcase 15:\r\n\t\t\t\tSystem.out.println(\"\u3053\u3093\u306b\u3061\u306f\u3002\u5c45\u7720\u308a\u3057\u306a\u3044\u3088\u3046\u306b\uff01\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 16: \/\/ hour\u304c16\u6642\u304b\u308918\u6642\u306e\u5834\u5408\r\n\t\t\tcase 17:\r\n\t\t\tcase 18:\r\n\t\t\t\tSystem.out.println(\"\u3042\u3068\u5c11\u3057\u9811\u5f35\u308a\u307e\u3057\u3087\u3046\u3002\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase 19: \/\/ hour\u304c19\u6642\u304b\u308921\u6642\u306e\u5834\u5408\r\n\t\t\tcase 20:\r\n\t\t\tcase 21:\r\n\t\t\t\tSystem.out.println(\"\u304a\u75b2\u308c\u69d8\u3002\u307e\u305f\u660e\u65e5\uff01\");\r\n\t\t\t\tbreak;\r\n\t\t\tdefault: \/\/ hour\u304c\u4e0a\u8a18\u306e\u6642\u9593\u5e2f\u4ee5\u5916\u306e\u5834\u5408\r\n\t\t\t\tSystem.out.println(\"\u9811\u5f35\u308a\u904e\u304e\u3067\u3059\u3002\u4f11\u307f\u307e\u3057\u3087\u3046\u3002\");\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\t\tswitch\u6587\u3092\u4f7f\u3063\u3066\u305d\u308c\u305e\u308c\u306e\u6642\u9593\u5e2f\u3054\u3068\u306b\u51fa\u529b\u3059\u308b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5909\u3048\u3066\u6761\u4ef6\u5206\u5c90\u3057\u307e\u3059\u3002<br \/>\n\t\t\u6761\u4ef6\u5206\u5c90\u306e\u3069\u308c\u306b\u3082\u5f53\u3066\u306f\u307e\u3089\u306a\u3044\u5834\u5408\u3001default\u6587\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\n\t<\/p><\/div>\n<\/div>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-5\"><span class=\"Num\">5.<\/span>\u7e70\u308a\u8fd4\u3057\uff08\u30eb\u30fc\u30d7\uff09\u51e6\u7406<\/h3>\n<p>\u6b21\u306f\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u51e6\u7406\u306e\u4e2d\u3067\u3001\u4f55\u5ea6\u3082\u540c\u3058\u51e6\u7406\u3092\u7e70\u308a\u8fd4\u3057\u3066\u884c\u3046\u3068\u304d\u306e\u6587\u6cd5\u3092\u5b66\u7fd2\u3057\u307e\u3059\u3002<\/p>\n<p>\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306f\u3001\u30eb\u30fc\u30d7\u51e6\u7406\u3068\u3082\u547c\u3070\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u30a4\u30e1\u30fc\u30b8\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\u5909\u6570i\u304c1\u304b\u3089\u59cb\u307e\u308a\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u884c\u308f\u308c\u308b\u305f\u3073\u306b\u3001\u5909\u6570i\u306e\u5024\u304c1\u305a\u3064\u5897\u3048\u307e\u3059\u3002<br \/>\ni\u304c5\u306b\u306a\u308b\u307e\u3067\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u7d9a\u304d\u3001\u300c\u7e70\u308a\u8fd4\u3057\u3066\u3044\u307e\u3059\u30fb\u30fb\u30fb\u300d\u304c4\u56de\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a class=\"Ext Image-link\" href=\"https:\/\/techfun.cc\/wp-content\/uploads\/2024\/06\/loop.png\"><br \/>\n\t<img decoding=\"async\" src=\"https:\/\/techfun.cc\/wp-content\/uploads\/2024\/06\/loop.png\" alt=\"loop\"><br \/>\n<\/a><\/p>\n<p>\u672c\u9805\u3067\u306f\u3001for\u6587\u3068while\u6587\u3068\u3044\u3046\u30012\u3064\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u6587\u6cd5\u3092\u5b66\u7fd2\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-5-1\"><span class=\"Num\">5.1.<\/span>for\u6587<\/h4>\n<p>\u6700\u521d\u306f\u3001for\u6587\u3067\u3059\u3002for\u6587\u306f\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u6587\u6cd5\u306e\u4e2d\u3067\u3001\u3088\u304f\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<br \/>\nfor\u6587\u306e\u66f8\u5f0f\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>for (\u7e70\u308a\u8fd4\u3057\u306e\u6700\u521d\u306e\u51e6\u7406; \u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u6761\u4ef6\u5f0f; \u7e70\u308a\u8fd4\u3057\u306e\u4e2d\u3067\u6bce\u56de\u5b9f\u884c\u3059\u308b\u51e6\u7406) {\r\n\t\u7e70\u308a\u8fd4\u3057\u305f\u3044\u51e6\u7406\r\n}<\/code><\/pre>\n<p>for\u6587\u306e{}\u306e\u4e2d\u306b\u3001\u7e70\u308a\u8fd4\u3057\u305f\u3044\u51e6\u7406\u3092\u66f8\u304d\u307e\u3059\u3002\u307e\u305f\u3001for\u306e\u5f8c\u306e()\u306e\u4e2d\u306f\u3001;\uff08\u30bb\u30df\u30b3\u30ed\u30f3\uff09\u30673\u3064\u306b\u5206\u304b\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u6700\u521d\u306e\u300c\u7e70\u308a\u8fd4\u3057\u306e\u6700\u521d\u306e\u51e6\u7406\u300d\u306f\u3001for\u6587\u306e\u51e6\u7406\u304c\u59cb\u307e\u3063\u305f\u6700\u521d\u306b1\u56de\u3060\u3051\u5b9f\u884c\u3055\u308c\u308b\u51e6\u7406\u3067\u3059\u3002<br \/>\n\u6b21\u306e\u300c\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u6761\u4ef6\u5f0f\u300d\u306f\u3001for\u6587\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u884c\u3046\u304b\u5426\u304b\u3092\u5224\u5b9a\u3059\u308b\u6761\u4ef6\u5f0f\u3067\u3059\u3002<br \/>\n\u6700\u5f8c\u306e\u300c\u7e70\u308a\u8fd4\u3057\u306e\u4e2d\u3067\u6bce\u56de\u5b9f\u884c\u3055\u308c\u308b\u51e6\u7406\u300d\u306f\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u884c\u3046\u3054\u3068\u306b\u5b9f\u884c\u3055\u308c\u308b\u51e6\u7406\u3067\u3059\u3002<\/p>\n<p>\u6587\u7ae0\u3060\u3051\u3067\u306f\u5206\u304b\u308a\u306b\u304f\u3044\u305f\u3081\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u4f8b\u3092\u4e00\u3064\u7d39\u4ecb\u3057\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u3001int\u578b\u5909\u6570i\u304c1\u304b\u3089\u59cb\u307e\u3063\u3066\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u4e2d\u30671\u305a\u3064\u6570\u304c\u5897\u3048\u3066\u30015\u306b\u306a\u308b\u307e\u3067\u3001\u305d\u306e\u5909\u6570i\u3092\u51fa\u529b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002<\/p>\n<div class=\"Pre-title\">For1.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>public class For1 {\r\n\tpublic static void main(String[] args) {\r\n\t\tfor (int i = 1; i &lt; 5; i++) { \/\/ \u5909\u6570i\u304c1\u304b\u30895\u306b\u306a\u308b\u307e\u3067\u7e70\u308a\u8fd4\u3057\u51e6\u7406\r\n\t\t\tSystem.out.println(i); \/\/ i\u306e\u5024\uff081\u30012\u30013\u30014\uff09\u3092\u51fa\u529b\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\u300cSystem.out.println(i);\u300d\u304c\u7e70\u308a\u8fd4\u3057\u305f\u3044\u51e6\u7406\u3067\u3001for\u306e()\u306e\u300cint i = 1;\u300d\u304c\u7e70\u308a\u8fd4\u3057\u306e\u6700\u521d\u306b\u51e6\u7406\u3055\u308c\u3001\u300ci < 5;\u300d\u304c\u7e70\u308a\u8fd4\u3057\u306e\u6761\u4ef6\u5f0f\u3067\u3001\u300ci&#43;&#43;\u300d\u306f\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3054\u3068\u306b\u884c\u3046\u51e6\u7406\u3067\u3059\u3002\n\t\u51e6\u7406\u306e\u9806\u756a\u3068\u3057\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002 \n\n<ol class=\"Base-list Base-list--ol\">\n<li class=\"Base-list__child\">\u7e70\u308a\u8fd4\u3057\u306e\u6700\u521d\u306b\u5909\u6570i\u306b1\u3092\u4ee3\u5165<\/li>\n<li class=\"Base-list__child\">\u300ci < 5;\u300d\u306e\u6761\u4ef6\u5f0f\u306etrue\u306e\u9593\u3001\u300cSystem.out.println(i);\u300d\u3092\u5b9f\u884c <\/li>\n<li class=\"Base-list__child\">\u300cSystem.out.println(i);\u300d\u304c\u5b9f\u884c\u3055\u308c\u308b\u305f\u3073\u306b\u3001\u300ci&#43;&#43;\u300d\u3067i\u306b1\u3092\u52a0\u7b97 <\/li>\n<li class=\"Base-list__child\">i\u304c5\u306b\u306a\u308b\u3068\u3001\u300ci < 5;\u300d\u304cfalse\u306b\u306a\u308b\u306e\u3067\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u7d42\u4e86 <\/li>\n<\/ol>\n<p>\t\t\t\u5909\u6570\u306e\u5024\u3084\u6761\u4ef6\u5f0f\u3092\u5909\u66f4\u3057\u3066\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u52d5\u4f5c\u3055\u305b\u3066\u307f\u307e\u3057\u3087\u3046\u3002for\u6587\u306e\u51e6\u7406\u304c\u3088\u308a\u660e\u78ba\u306b\u898b\u3048\u3066\u304f\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-5-2\"><span class=\"Num\">5.2.<\/span>while\u6587<\/h4>\n<p>\t\t\tfor\u6587\u306e\u6b21\u306f\u3001while\u6587\u3067\u3059\u3002while\u6587\u306e\u66f8\u5f0f\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\t\t\tfor\u6587\u3068\u6bd4\u3079\u308b\u3068\u30b7\u30f3\u30d7\u30eb\u306b\u898b\u3048\u307e\u3059\u304c\u3001\u901a\u5e38\u3001\u7e70\u308a\u8fd4\u3057\u306e\u6700\u521d\u306e\u51e6\u7406\u3068\u7e70\u308a\u8fd4\u3057\u3054\u3068\u306b\u884c\u3046\u51e6\u7406\u3092\u5225\u9014\u8a18\u8ff0\u3059\u308b\u306e\u3067\u3001for\u6587\u3088\u308a\u884c\u6570\u304c\u591a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>while (\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u6761\u4ef6\u5f0f) {\r\n\t\u7e70\u308a\u8fd4\u3057\u305f\u3044\u51e6\u7406\r\n}<\/code><\/pre>\n<p>\t\t\t\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u66f8\u304f\u3068\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\t\t\tfor\u6587\u3067\u8aac\u660e\u3057\u305fint\u578b\u5909\u6570i\u304c1\u304b\u3089\u59cb\u307e\u3063\u3066\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u4e2d\u30671\u305a\u3064\u6570\u304c\u5897\u3048\u3066\u30015\u306b\u306a\u308b\u307e\u3067\u3001\u305d\u306e\u5909\u6570i\u3092\u51fa\u529b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002<\/p>\n<div class=\"Pre-title\">While1.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>public class While1 {\r\n\tpublic static void main(String[] args) {\r\n\t\tint i = 1;\r\n\t\twhile (i &lt; 5) { \/\/ \u5909\u6570i\u304c1\u304b\u30895\u306b\u306a\u308b\u307e\u3067\u7e70\u308a\u8fd4\u3057\u51e6\u7406\r\n\t\t\tSystem.out.println(i); \/\/ i\u306e\u5024\uff081\u30012\u30013\u30014\uff09\u3092\u51fa\u529b\r\n\t\t\ti++; \/\/ i\u306e\u5024\u306b1\u3092\u52a0\u7b97\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\t\t\tfor\u6587\u3067\u8a18\u8ff0\u3057\u305f\u3082\u306e\u3068\u540c\u69d8\u306e\u7d50\u679c\u304c\u51fa\u529b\u3055\u308c\u305f\u306f\u305a\u3067\u3059\u3002<br \/>\n\t\t\t\u540c\u69d8\u306b\u3001\u5909\u6570\u306e\u5024\u3084\u6761\u4ef6\u5f0f\u3092\u5909\u66f4\u3057\u3066\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u52d5\u4f5c\u3055\u305b\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-5-3\"><span class=\"Num\">5.3.<\/span>break\u3068continue<\/h4>\n<p>\t\t\tbreak\u3084continue\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u4e2d\u3067\u5f37\u5236\u7684\u306b\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u7d42\u4e86\u3057\u305f\u308a\u3001\u5f37\u5236\u7684\u306b\u6b21\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u884c\u3063\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\t\t\t\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u5f37\u5236\u7684\u306b\u7d42\u4e86\u3059\u308b\u5834\u5408\u306f\u3001<span class=\"Text-highlight\">break;<\/span>\u3092\u4f7f\u3044\u307e\u3059\u3002<br \/>\n\t\t\t\u307e\u305f\u3001\u6b21\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306b\u5f37\u5236\u7684\u306b\u51e6\u7406\u3092\u3068\u3070\u3059\u5834\u5408\u3001<span class=\"Text-highlight\">continue;<\/span>\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\t\t\t\u4ee5\u4e0b\u306f\u3001break\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<div class=\"Pre-title\">Break1.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>public class Break1 {\r\n\tpublic static void main(String[] args) {\r\n\t\tint i = 1; \/\/ for\u6587\u306e\u521d\u671f\u51e6\u7406\u3067\u3042\u308bi\u306e\u5b9a\u7fa9\u3068\u4ee3\u5165\r\n\r\n\t\t\/\/ \u5909\u6570i\u304c1\u304b\u30895\u306b\u306a\u308b\u307e\u3067\u7e70\u308a\u8fd4\u3057\u51e6\u7406\uff08\u521d\u671f\u51e6\u7406\u306e\u8a18\u8ff0\u306f\u3001\u7701\u7565\uff09\r\n\t\tfor ( ; i &lt; 5; i++) {\r\n\t\t\tSystem.out.println(i); \/\/ i\u306e\u5024\uff081\u30012\u30013\uff09\u3092\u51fa\u529b\r\n\t\t\tif (i == 3) { \/\/ \u3082\u3057\u3001i\u304c3\u306e\u5834\u5408\r\n\t\t\t\tbreak; \/\/ \u3053\u3053\u3067\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u7d42\u4e86\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"i\u304c\" + i + \"\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u51e6\u7406\u7d42\u4e86\uff01\");\r\n\t}\r\n}<\/code><\/pre>\n<p>\t\t\t\u4ee5\u4e0b\u306f\u3001continue\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<div class=\"Pre-title\">Continue1.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>public class Continue1 {\r\n\tpublic static void main(String[] args) {\r\n\t\tfor (int i = 1; i &lt; 5; i++) { \/\/ \u5909\u6570i\u304c1\u304b\u30895\u306b\u306a\u308b\u307e\u3067\u7e70\u308a\u8fd4\u3057\u51e6\u7406\r\n\t\t\tif (i == 3) { \/\/ \u3082\u3057\u3001i\u304c3\u306e\u5834\u5408\r\n\t\t\t\t\/\/ \u3053\u306e\u5148\u306e\u51fa\u529b\u51e6\u7406\u3092\u3068\u3070\u3057\u3066\u3001\u6b21\u306e\u7e70\u308a\u8fd4\u3057\u3078\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tSystem.out.println(i); \/\/ i\u306e\u5024\uff081\u30012\u30014\uff09\u3092\u51fa\u529b\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\t\t\tbreak\u3084continue\u306f\u3001\u7e70\u308a\u8fd4\u3057\u306e\u51e6\u7406\u306e\u4e2d\u3067\u4f7f\u7528\u3059\u308b\u3068\u3001\u3088\u308a\u8272\u3005\u306a\u51e6\u7406\u306e\u6d41\u308c\u3092\u4f5c\u308a\u3060\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div class=\"Information-block\">\n<div class=\"Information-heading\">\n<div class=\"Google-icon Google-icon--information\"><\/div>\n<div class=\"Information-heading__child\">Information<\/div>\n<\/p><\/div>\n<div class=\"Heading Title Title--xs\">\u7121\u9650\u30eb\u30fc\u30d7\u306b\u6ce8\u610f\uff01<\/div>\n<p>\t\t\t\t\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3067\u3001\u6c38\u4e45\u306b\u30eb\u30fc\u30d7\u304c\u6b62\u307e\u3089\u306a\u3044\u3053\u3068\u3092\u7121\u9650\u30eb\u30fc\u30d7\u3068\u8a00\u3044\u307e\u3059\u3002<\/p>\n<p>\t\t\t\t\u4f8b\u3048\u3070\u3001\u6761\u4ef6\u5f0f\u306e\u6307\u5b9a\u3092\u5fd8\u308c\u3066\u3057\u307e\u3063\u305f\u3001i&#43;&#43;\u3092\u5fd8\u308c\u3066\u3057\u307e\u3063\u305f\u7b49\u3001\u5c0f\u3055\u306a\u30df\u30b9\u304c\u7406\u7531\u3067\u3082\u7121\u9650\u30eb\u30fc\u30d7\u306f\u767a\u751f\u3057\u307e\u3059\u3002<br \/>\n\t\t\t\t\u6761\u4ef6\u5f0f\u3092\u5fd8\u308c\u308b\u306a\u3069\u306f\u3001\u3042\u307e\u308a\u306b\u6ce8\u610f\u4e0d\u8db3\u3068\u8a00\u3048\u307e\u3059\u304c\u3001\u3061\u3087\u3063\u3068\u3057\u305f\u66f8\u304d\u9593\u9055\u3044\u3067\u3082\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306f\u7121\u9650\u30eb\u30fc\u30d7\u3068\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u306e\u3067\u3001\u6c17\u3092\u3064\u3051\u307e\u3057\u3087\u3046\u3002<br \/>\n\t\t\t\t\u305d\u308c\u3067\u3082\u7121\u9650\u30eb\u30fc\u30d7\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u5834\u5408\u306f\u3001eclipse\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u306e\u4e0a\u306b\u8868\u793a\u3055\u308c\u308b\u8d64\u3044\u56db\u89d2\u306e\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u3001\u51e6\u7406\u3092\u5f37\u5236\u7d42\u4e86\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\t\t\t\t\u653e\u3063\u3066\u304a\u304f\u3068\u3001\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u30e1\u30e2\u30ea\u304c\u3044\u3063\u3071\u3044\u306b\u306a\u308a\u3001\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u51e6\u7406\u304c\u9045\u304f\u306a\u308a\u307e\u3059\u3002\u9045\u304f\u306a\u3063\u305f\u5834\u5408\u306f\u3001\u518d\u8d77\u52d5\u3092\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\t\t\t\t<a class=\"Ext Image-link\" href=\"https:\/\/techfun.cc\/wp-content\/uploads\/2024\/06\/mugenloop.png\"><br \/>\n\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/techfun.cc\/wp-content\/uploads\/2024\/06\/mugenloop.png\" alt=\"mugenloop\"><br \/>\n\t\t\t\t<\/a><\/p><\/div>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/p><\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-6\"><span class=\"Num\">6.<\/span>\u7df4\u7fd2\u554f\u984c4<\/h3>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-6-1\"><span class=\"Num\">6.1.<\/span>\u554f\u984c1<\/h4>\n<p>\t\t\t\u300cfor\u6587\u300d\u3092\u4f7f\u7528\u3057\u3066\u3001\u4e5d\u4e5d\u306e7\u306e\u6bb5\u304c\u8868\u793a\u3055\u308c\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>\u4e5d\u4e5d\u306e7\u306e\u6bb5\r\n\r\n7*1=7\r\n7*2=14\r\n\uff1a    \uff1a\r\n7*9=63<\/code><\/pre>\n<div class=\"Answer-block\">\n\t\t\t\t<input class=\"SW\" type=\"checkbox\" id=\"Answer-content-3\"><label for=\"Answer-content-3\" class=\"Answer-SW\"><span\n\t\t\t\t\t\tclass=\"Google-icon Google-icon--arrow-single-gray\"><\/span>\u89e3\u7b54\u3092\u8868\u793a\u3059\u308b<\/label><\/p>\n<div class=\"Answer-content\">\n<div class=\"Pre-title\">Mondai13_1.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>\/**\r\n * \u51e6\u7406\u6982\u8981\uff1afor\u6587\u3092\u4f7f\u7528\u3057\u305f\u7e70\u308a\u8fd4\u3057\u51e6\u7406(\u4e5d\u4e5d\u306e7\u306e\u6bb5\u306e\u51fa\u529b)\r\n *\/\r\npublic class Mondai13_1 {\r\n\tpublic static void main(String[] args) {\r\n\t\t\/\/ int\u578b\u5b9a\u6570DAN\u306e\u5ba3\u8a00\u3068\u50247\u306e\u4ee3\u5165\r\n\t\tfinal int DAN = 7;\r\n\r\n\t\t\/\/ \u300c\u4e5d\u4e5d\u306e7\u306e\u6bb5\u300d\u3092\u51fa\u529b\r\n\t\tSystem.out.println(\"\u4e5d\u4e5d\u306e7\u306e\u6bb5\");\r\n\r\n\t\t\/\/ 7\u306e\u6bb5\u3092\u51fa\u529b\r\n\t\tfor (int i = 1; i &lt;= 9; i++) {\r\n\t\t\tSystem.out.println(DAN + \" * \" + i + \" = \" + (DAN * i));\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\t\t\t\t\t\u307e\u305a\u6700\u521d\u306b\u4e5d\u4e5d\u306e\u6bb5\u3092\u683c\u7d0d\u3059\u308bint\u578b\u306e\u5b9a\u6570DAN\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002<br \/>\n\t\t\t\t\t\u4e5d\u4e5d\u306e\u6bb5\u306b\u3064\u3044\u3066\u306f\u3001\u3053\u306e\u51e6\u7406\u306e\u4e2d\u3067\u5909\u66f4\u3057\u307e\u305b\u3093\u306e\u3067\u3001\u5b9a\u6570\u3067\u5b9a\u7fa9\u3057\u305f\u307b\u3046\u304c\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\t\t\t\t\tfor\u6587\u3092\u4f7f\u7528\u3057\u3066\u30011\u304b\u30899\u307e\u3067\u5909\u6570i\u3092\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\u3057\u307e\u3059\u3002<br \/>\n\t\t\t\t\t\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\u3068\u306f\u3001\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u306b\u5bfe\u3057\u3066\u3001\u3060\u3093\u3060\u3093\u3068\u6570\u5024\u304c\u5897\u3048\u3066\u3044\u304f\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u3059\u3002<\/p>\n<p>\t\t\t\t\t\u5909\u6570i\u3068\u5b9a\u6570DAN\u3092\u4f7f\u3063\u3066\u3001\u8a08\u7b97\u3092\u884c\u3044\u306a\u304c\u3089\u3001\u4e5d\u4e5d\u306e7\u306e\u6bb5\u3092\u51fa\u529b\u3057\u307e\u3059\u3002<br \/>\n\t\t\t\t\t\u5909\u6570i\u304c1\u306e\u6642\u3001\u300cDAN + &quot; * &quot; + i + &quot; = &quot; + (DAN * i)\u300d\u3067\u300c7 * 1 = 7\u300d\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<br \/>\n\t\t\t\t\t\u5909\u6570i\u304c2\u306e\u6642\u3001\u300c7 * 2 = 14\u300d\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002\n\t\t\t\t<\/p><\/div>\n<\/p><\/div>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-6-2\"><span class=\"Num\">6.2.<\/span>\u554f\u984c2<\/h4>\n<p>\t\t\t\u300cwhile\u6587\u300d\u3092\u4f7f\u7528\u3057\u3066\u3001\u554f\u984c1\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"Answer-block\">\n\t\t\t\t<input class=\"SW\" type=\"checkbox\" id=\"Answer-content-4\"><label for=\"Answer-content-4\" class=\"Answer-SW\"><span\n\t\t\t\t\t\tclass=\"Google-icon Google-icon--arrow-single-gray\"><\/span>\u89e3\u7b54\u3092\u8868\u793a\u3059\u308b<\/label><\/p>\n<div class=\"Answer-content\">\n<div class=\"Pre-title\">Mondai13_2.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>\/**\r\n * \u51e6\u7406\u6982\u8981\uff1awhile\u6587\u3092\u4f7f\u7528\u3057\u305f\u7e70\u308a\u8fd4\u3057\u51e6\u7406(\u4e5d\u4e5d\u306e7\u306e\u6bb5\u306e\u51fa\u529b)\r\n *\/\r\npublic class Mondai13_2 {\r\n\tpublic static void main(String[] args) {\r\n\t\t\/\/ int\u578b\u5b9a\u6570DAN\u306e\u5ba3\u8a00\u3068\u50247\u306e\u4ee3\u5165\r\n\t\tfinal int DAN = 7;\r\n\r\n\t\t\/\/ \u300c\u4e5d\u4e5d\u306e7\u306e\u6bb5\u300d\u3092\u51fa\u529b\r\n\t\tSystem.out.println(\"\u4e5d\u4e5d\u306e7\u306e\u6bb5\");\r\n\r\n\t\t\/\/ \u5909\u6570i\u306e\u5ba3\u8a00\u3068\u50241\u306e\u4ee3\u5165\r\n\t\tint i = 1;\r\n\r\n\t\t\/\/ 7\u306e\u6bb5\u3092\u51fa\u529b\r\n\t\twhile (i &lt;= 9) {\r\n\t\t\tSystem.out.println(DAN + \" * \" + i + \" = \" + (DAN * i));\r\n\t\t\ti++;\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\t\t\t\t\tfor\u6587\u306e\u51e6\u7406\u3068\u57fa\u672c\u7684\u306b\u5909\u308f\u308a\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\t\t\t\t\twhile\u6587\u306e\u5834\u5408\u3001\u521d\u671f\u51e6\u7406\u3067\u3042\u308b\u5909\u6570i\u306e\u5ba3\u8a00\u3068\u5024\u306e\u4ee3\u5165\u306f\u3001\u7e70\u308a\u8fd4\u3057\u306e\u51e6\u7406\u304c\u59cb\u307e\u308b\u524d\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<br \/>\n\t\t\t\t\t\u307e\u305f\u3001\u5909\u6570i\u306e\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u51e6\u7406\u306f\u3001while\u6587\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u6700\u5f8c\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002\n\t\t\t\t<\/p><\/div>\n<\/p><\/div>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-6-3\"><span class=\"Num\">6.3.<\/span>\u554f\u984c3<\/h4>\n<p>\t\t\t\u300cfor\u6587\u300d\u3092\u4f7f\u7528\u3057\u3066\u30011\u304b\u308910\u307e\u3067\u306e\u6570\u3092\u52a0\u7b97\u3057\u3001\u305d\u306e\u7d50\u679c\u3092\u300c\u5408\u8a08\u306f\u300155\u3067\u3059\u3002\u300d\u3068\u753b\u9762\u306b\u8868\u793a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"dlist\">\n<dl>\n<dt class=\"hdlist1\"><span class=\"Text-highlight\">\u5b9f\u88c5\u306e\u30d2\u30f3\u30c8\uff1a<\/span><\/dt>\n<dd>\n\t\t\t\t\t\t\u30fbfor\u6587\u306e\u5b9f\u884c\u5f8c\u306b\u5408\u8a08\u5024\u3092\u8868\u793a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u3001\u5408\u8a08\u5024\u3092\u683c\u7d0d\u3059\u308b\u305f\u3081\u306e\u5909\u6570\u306ffor\u6587\u3088\u308a\u524d\u3067\u5ba3\u8a00\u3057\u307e\u3057\u3087\u3046\u3002\n\t\t\t\t\t<\/dd>\n<\/dl><\/div>\n<p>\t\t<span class=\"Text-highlight\">\u203b\u3053\u306e\u554f\u984c\u306e\u89e3\u7b54\u306f\u63b2\u8f09\u3057\u3066\u304a\u308a\u307e\u305b\u3093\u3002<span class=\"Post-link\" >Tech Fun IT\u30b9\u30af\u30fc\u30eb\u306eJava\u7814\u4fee<\/span>\u3067\u306f\u3001\u8b1b\u5e2b\u304c\u4e01\u5be7\u306b\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/span><br \/>\n<span class=\"Text-red-bold\">\u73fe\u5728Tech Fun IT\u30b9\u30af\u30fc\u30eb\u3067\u306f\u3001\u65b0\u898f\u53d7\u8b1b\u8005\u306e\u52df\u96c6\u306f\u884c\u306a\u3063\u3066\u304a\u308a\u307e\u305b\u3093\u3002<\/span><\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-6-4\"><span class=\"Num\">6.4.<\/span>\u554f\u984c4<\/h3>\n<p>\t\t\t\t\u300cwhile\u6587\u300d\u3092\u4f7f\u7528\u3057\u3066\u3001\u554f\u984c3\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\t\t\t\t<span class=\"Text-highlight\">\u203b\u3053\u306e\u554f\u984c\u306e\u89e3\u7b54\u306f\u63b2\u8f09\u3057\u3066\u304a\u308a\u307e\u305b\u3093\u3002<span class=\"Post-link\" >Tech Fun IT\u30b9\u30af\u30fc\u30eb\u306eJava\u7814\u4fee<\/span>\u3067\u306f\u3001\u8b1b\u5e2b\u304c\u4e01\u5be7\u306b\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/span><br \/>\n<span class=\"Text-red-bold\">\u73fe\u5728Tech Fun IT\u30b9\u30af\u30fc\u30eb\u3067\u306f\u3001\u65b0\u898f\u53d7\u8b1b\u8005\u306e\u52df\u96c6\u306f\u884c\u306a\u3063\u3066\u304a\u308a\u307e\u305b\u3093\u3002<\/span><\/p>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/p><\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-7\"><span class=\"Num\">7.<\/span>Java\u306e\u57fa\u672c\uff08\u524d\u7de8\u30fb\u5f8c\u7de8\uff09\u306e\u307e\u3068\u3081<\/h3>\n<ul class=\"Base-list\">\n<li class=\"Base-list__child\">\u547d\u4ee4\u6587\u306e\u7d42\u308f\u308a\uff08\u57fa\u672c\u7684\u306b\u306f\u884c\u672b\uff09\u306b\u306f\u30bb\u30df\u30b3\u30ed\u30f3\u3092\u4ed8\u3051\u308b\u3002<\/li>\n<li class=\"Base-list__child\">\u51e6\u7406\u306e\u307e\u3068\u307e\u308a\u306f\u300c\uff5b\uff5d\uff08\u62ec\u5f27\uff09\u300d\u3067\u56f2\u3080\u3002<\/li>\n<li class=\"Base-list__child\">\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u8868\u793a\u3059\u308b\u6642\u306f\u300cSystem.out.println(&quot;\u51fa\u529b\u3057\u305f\u3044\u6587\u5b57\u5217&quot;);\u300d\u3092\u4f7f\u3046\u3002<\/li>\n<li class=\"Base-list__child\">\u5909\u6570\u5ba3\u8a00\u306f\u300cint x;\u300d\u306e\u3088\u3046\u306b\u300c\u30c7\u30fc\u30bf\u578b \u5909\u6570\u540d;\u300d\u3068\u3057\u3001\u4ee3\u5165\u3059\u308b\u3068\u304d\u306f\u300cx = 2;\u300d\u306a\u3069\u3068\u3059\u308b\u3002<\/li>\n<li class=\"Base-list__child\">\u300c\u30c7\u30fc\u30bf\u578b\u300d\u306f\u3001\u6570\u5024\u3084\u6587\u5b57\u5217\u306a\u3069\u6271\u3046\u30c7\u30fc\u30bf\u306e\u7a2e\u985e\u306b\u3088\u3063\u3066\u4f7f\u3044\u5206\u3051\u304c\u5fc5\u8981\u3067\u3042\u308b\u3002 <\/li>\n<li class=\"Base-list__child\">\u52a0\u6e1b\u4e57\u9664\u306f\u305d\u308c\u305e\u308c\u300c+\u300d\u3001\u300c-\u300d\u3001\u300c*\u300d\u3001\u300c\/\u300d\u306e\u300c\u7b97\u8853\u6f14\u7b97\u5b50\u300d\u3092\u4f7f\u7528\u3059\u308b\u3002\u5270\u4f59\uff08\u4f59\u308a\uff09\u306f\u300c%\u300d\u3092\u4f7f\u7528\u3059\u308b\u3002 <\/li>\n<li class=\"Base-list__child\">\u6570\u5024\u30921\u5897\u3084\u3057\u305f\u308a\u6e1b\u3089\u3057\u305f\u308a\u3059\u308b\u3068\u304d\u306f\u300c++\u300d\u3084\u300c&#8211;\u300d\u3092\u4f7f\u7528\u3059\u308b\u3002<\/li>\n<li class=\"Base-list__child\">2\u3064\u306e\u5909\u6570\u306e\u6bd4\u8f03\u306b\u306f\u300c==\u300d\u3084\u300c!=\u300d\u3001\u300c&gt;=\u300d\u306a\u3069\u306e\u300c\u95a2\u4fc2\u6f14\u7b97\u5b50\u300d\u3092\u4f7f\u7528\u3059\u308b\u3002 <\/li>\n<li class=\"Base-list__child\">\u8907\u6570\u306e\u6761\u4ef6\u3092\u8a18\u8ff0\u3059\u308b\u969b\u306b\u306f\u300c&amp;&amp;\u300d\u3084\u300c||\u300d\u306e\u300c\u8ad6\u7406\u6f14\u7b97\u5b50\u300d\u3092\u4f7f\u7528\u3059\u308b\u3002 <\/li>\n<li class=\"Base-list__child\">\u69d8\u3005\u306a\u6761\u4ef6\u306b\u3088\u3063\u3066\u51e6\u7406\u3092\u5206\u5c90\u3055\u305b\u308b\u5834\u5408\u306f\u3001\u300cif\u6587\u300d\u3084\u300cswitch\u6587\u300d\u306a\u3069\u3092\u4f7f\u7528\u3059\u308b\u3002<\/li>\n<li class=\"Base-list__child\">\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u884c\u3046\u5834\u5408\u306f\u300cfor\u6587\u300d\u3084\u300cwhile\u6587\u300d\u3092\u4f7f\u7528\u3059\u308b\u3002<\/li>\n<\/ul>\n<p>\t\t\t\t\u672c\u7ae0\u3067\u5b66\u3093\u3060\u3053\u3068\u3092\u3082\u3068\u306b\u3001\u4eca\u5f8c\u306e\u5b66\u7fd2\u3092\u9032\u3081\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\t\t\t\t\u3057\u3063\u304b\u308a\u3068\u7406\u89e3\u3067\u304d\u3066\u3044\u308b\u304b\u4e0d\u5b89\u306a\u5834\u5408\u306f\u3001\u6559\u6750\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u3082\u3046\u4e00\u5ea6\u52d5\u304b\u3057\u3066\u307f\u308b\u306a\u3069\u3057\u3066\u5fa9\u7fd2\u3057\u3066\u304a\u304f\u3068\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\t\t\t\tJava\u306e\u57fa\u672c\u7684\u306a\u6587\u6cd5\u3068\u30eb\u30fc\u30eb\u306b\u3064\u3044\u3066\u306e\u8aac\u660e\u306f\u3001\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u672c\u7ae0\u3067\u306e\u5b66\u7fd2\u9805\u76ee Java\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8a18\u8ff0\u3059\u308b\u4e0a\u3067\u6700\u4f4e\u9650\u5fc5\u8981\u306a\u57fa\u672c\u30eb\u30fc\u30eb\u3068\u57fa\u672c\u6587\u6cd5\u3092\u5b66\u7fd2\u3059\u308b\u300cJava\u306e\u57fa\u672c\u300d\u306e\u5f8c\u7de8\u3067\u3059\u3002 \u524d\u7de8\u3067\u306f\u69cb\u6587\u30eb\u30fc\u30eb\u3084\u30c7\u30fc\u30bf\u578b\u3001\u6f14\u7b97\u5b50\u306a\u3069\u3092\u6271\u3044\u307e\u3057\u305f\u304c\u3001\u5f8c\u7de8\u3067\u306f\u6761\u4ef6\u51e6\u7406\u3084\u7e70\u308a\u8fd4\u3057\u3092\u6271\u3044\u307e\u3059\u2026<\/p>\n","protected":false},"author":5,"featured_media":5999,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"class_list":["post-5679","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java-base"],"acf":{"chapter":4,"javabase_order":5,"list-display_description":"Java\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8a18\u8ff0\u3059\u308b\u4e0a\u3067\u6700\u4f4e\u9650\u5fc5\u8981\u306a\u57fa\u672c\u30eb\u30fc\u30eb\u3068\u57fa\u672c\u6587\u6cd5\u3092\u5b66\u7fd2\u3059\u308b\u57fa\u672c\u8b1b\u5ea7\u306e\u5f8c\u7de8\u3067\u3059\u3002"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/posts\/5679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/comments?post=5679"}],"version-history":[{"count":27,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/posts\/5679\/revisions"}],"predecessor-version":[{"id":6506,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/posts\/5679\/revisions\/6506"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/media\/5999"}],"wp:attachment":[{"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/media?parent=5679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/categories?post=5679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}