{"id":15,"date":"2023-10-24T12:52:46","date_gmt":"2023-07-26T13:05:40","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/"},"modified":"2025-07-31T09:32:58","modified_gmt":"2025-07-31T00:32:58","slug":"java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/","title":{"rendered":"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\uff1a\u5b8c\u5168\u30ac\u30a4\u30c92025\u5e74\u7248"},"content":{"rendered":"<h3>\u30a4\u30f3\u30c8\u30ed\u30c0\u30af\u30b7\u30e7\u30f3<\/h3>\n<p>\u914d\u5217\u306f\u3001\u8907\u6570\u306e\u8981\u7d20\u3092\u30b0\u30eb\u30fc\u30d7\u5316\u3057\u3066\u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u914d\u5217\u3092\u4f7f\u3048\u3070\u3001\u53c2\u7167\u578b\u3084\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u3092\u542b\u3080\u3069\u3093\u306a\u7a2e\u985e\u306e\u30c7\u30fc\u30bf\u3067\u3082\u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u3059\u3079\u3066\u306e\u914d\u5217\u8981\u7d20\u306f\u540c\u3058\u30c7\u30fc\u30bf\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\u914d\u5217\u306e\u30c7\u30fc\u30bf\u578b\u306f\u914d\u5217\u304c\u4f5c\u6210\u3055\u308c\u305f\u6642\u306b\u6307\u5b9a\u3055\u308c\u3001\u5909\u66f4\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u540c\u69d8\u306b\u3001\u914d\u5217\u306e\u9577\u3055\u3001\u3064\u307e\u308a\u3044\u304f\u3064\u306e\u8981\u7d20\u3092\u683c\u7d0d\u3067\u304d\u308b\u304b\u306f\u6700\u521d\u306b\u5b9a\u7fa9\u3055\u308c\u3001\u5909\u66f4\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u914d\u5217\u306fJava\u306b\u304a\u3044\u3066\u57fa\u672c\u7684\u306a\u5f79\u5272\u3092\u679c\u305f\u3057\u3001\u591a\u304f\u306e\u30b3\u30a2\u30c7\u30fc\u30bf\u578b\u304c\u305d\u308c\u306b\u57fa\u3065\u3044\u3066\u3044\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u3088\u304f\u4f7f\u308f\u308c\u308b\u53c2\u7167\u578b\u306eString\u306f\u5b9f\u969b\u306b\u306fchar\u8981\u7d20\u306e\u914d\u5217\u3068\u3057\u3066\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3067\u3059\u306e\u3067\u3001\u3042\u306a\u305f\u304c\u305d\u308c\u306b\u3064\u3044\u3066\u77e5\u3089\u306a\u304f\u3066\u3082\u3001\u3059\u3067\u306b\u914d\u5217\u3092\u4f7f\u3063\u305f\u3053\u3068\u304c\u3042\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5b89\u5168\u306b\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306bchar\u914d\u5217\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u914d\u5217\u306e\u4e00\u822c\u7684\u306a\u4f7f\u7528\u4f8b\u3067\u3059\u3002\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306b\u3001String\u3067\u306f\u306a\u304fchar\u914d\u5217\u3092\u4f7f\u7528\u3059\u308b\u306e\u306f\u3001String\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4e0d\u5909\u3067\u3042\u308b\u305f\u3081\u3067\u3059\u3002\u3064\u307e\u308a\u3001\u4e0a\u66f8\u304d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u3082\u306f\u3084\u30d1\u30b9\u30ef\u30fc\u30c9\u306eString\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u5fc5\u8981\u306a\u304f\u306a\u3063\u305f\u3068\u3057\u3066\u3082\u3001\u305f\u3060\u7834\u68c4\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u3053\u308c\u306f\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u30e1\u30e2\u30ea\u5185\u306b\u6b8b\u308b\u305f\u3081\u3001\u653b\u6483\u8005\u304c\u7406\u8ad6\u7684\u306b\u3053\u306e\u30e1\u30e2\u30ea\u306e\u4e00\u90e8\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8aad\u3080\u53ef\u80fd\u6027\u304c\u3042\u308b\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u3059\u3002\u5bfe\u7167\u7684\u306b\u3001char\u914d\u5217\u3068\u3057\u3066\u4fdd\u5b58\u3055\u308c\u305f\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u7c21\u5358\u306b\u4e0a\u66f8\u304d\u3057\u3001\u4f7f\u7528\u4e0d\u53ef\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u305f\u3081\u3001\u30e1\u30e2\u30ea\u3092\u691c\u67fb\u3057\u3066\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u53d6\u5f97\u3059\u308b\u53ef\u80fd\u6027\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h2>\u524d\u63d0\u6761\u4ef6 (Zenteij\u014dken)<\/h2>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u5f93\u3046\u306b\u306f\u3001\u4ee5\u4e0b\u304c\u5fc5\u8981\u3067\u3059\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>An environment in which you can execute Java programs to follow along with the examples. To set this up on your local machine, you will need the following:<\/li>\n<\/ul>\n<ul class=\"post-ul\">\n<li>Java (version 11 or above) installed on your machine, with the compiler provided by the Java Development Kit (JDK). For Ubuntu and Debian, follow the steps for Option 1 in our tutorial How To Install Java with Apt on Ubuntu 22.04. For other operating systems, including Mac and Windows, follow the download options for Java installation.<\/li>\n<li>To compile and run the code examples, this tutorial uses Java Shell, which is a Read-Evaluate-Print Loop (REPL) run from the command line. To get started with JShell, check out the Introduction to JShell guide. To avoid redundant instructions, all examples are executed in one JShell session and use the same variables.<\/li>\n<\/ul>\n<ul class=\"post-ul\">\n<li>Familiarity with Java and object-oriented programming, which you can find in our tutorial How To Write Your First Program in Java.<\/li>\n<li>An understanding of Java data types, which is discussed in our tutorial Understanding Data Types in Java.<\/li>\n<\/ul>\n<h2>\u914d\u5217\u306e\u4f5c\u6210<\/h2>\n<p>\u914d\u5217\u3092\u4f7f\u3044\u59cb\u3081\u308b\u306b\u306f\u3001\u307e\u305a\u914d\u5217\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u914d\u5217\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5\u306f\u3044\u304f\u3064\u304b\u3042\u308a\u3001\u914d\u5217\u304c\u4fdd\u6301\u3059\u308b\u8981\u7d20\u3092\u4e8b\u524d\u306b\u77e5\u3063\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u306b\u3088\u3063\u3066\u4f5c\u6210\u65b9\u6cd5\u304c\u7570\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"post-conf-info\">\n<p class=\"post-conf-desc\">Info<\/p>\n<div>\u60c5\u5831\uff1a\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306e\u4f8b\u306e\u30b3\u30fc\u30c9\u306b\u5f93\u3046\u305f\u3081\u306b\u306f\u3001jshell\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u30ed\u30fc\u30ab\u30eb\u30b7\u30b9\u30c6\u30e0\u3067Java\u30b7\u30a7\u30eb\u30c4\u30fc\u30eb\u3092\u958b\u3044\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u306e\u5f8c\u3001jshell&gt;\u30d7\u30ed\u30f3\u30d7\u30c8\u306e\u5f8c\u306b\u30b3\u30d4\u30fc\u3001\u8cbc\u308a\u4ed8\u3051\u3001\u307e\u305f\u306f\u4f8b\u3092\u7de8\u96c6\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002jshell\u3092\u7d42\u4e86\u3059\u308b\u306b\u306f\u3001\/exit\u3068\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/div>\n<\/div>\n<p>\u914d\u5217\u306e\u8981\u7d20\u304c\u5206\u304b\u3089\u306a\u3044\u5834\u5408\u3001\u7a7a\u306e\u914d\u5217\u3092\u4f5c\u6210\u3057\u3066\u30b5\u30a4\u30ba\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">char<mark><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><\/mark> password <span class=\"token operator\">=<\/span> new char<span class=\"token punctuation\">[<\/span><mark><span class=\"token number\">6<\/span><\/mark><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>char\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u5f8c\u306b\u7d9a\u304f\u7d44\u307f\u5408\u308f\u305b[]\u306f\u3001\u5909\u6570password\u3092\u914d\u5217\u3068\u3057\u3066\u5b9a\u7fa9\u3057\u307e\u3059\u3002char\u30ad\u30fc\u30ef\u30fc\u30c9\u306f\u3001\u5909\u6570\u304cchar\u306e\u57fa\u672c\u30c7\u30fc\u30bf\u578b\u3092\u4fdd\u6301\u3059\u308b\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u3059\u3002\u914d\u5217\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u306f\u3001char[6]\u3068\u3044\u3046\u5f62\u3067\u914d\u5217\u3092\u5b9a\u7fa9\u3057\u305fnew\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001char\u306e\u57fa\u672c\u30c7\u30fc\u30bf\u578b\u3092\u542b\u3093\u3067\u304a\u308a\u30016\u3064\u306e\u8981\u7d20\u3092\u4fdd\u6301\u3059\u308b\u914d\u5217\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u524d\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u51fa\u529b\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">password <span class=\"token operator\">==<\/span><span class=\"token operator\">&gt;<\/span> char<span class=\"token punctuation\">[<\/span><span class=\"token number\">6<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token string\">&#8216;\\000&#8217;<\/span>, <span class=\"token string\">&#8216;\\000&#8217;<\/span>, <span class=\"token string\">&#8216;\\000&#8217;<\/span>, <span class=\"token string\">&#8216;\\000&#8217;<\/span>, <span class=\"token string\">&#8216;\\000&#8217;<\/span>, <span class=\"token string\">&#8216;\\000&#8217;<\/span> <span class=\"token punctuation\">}<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u51fa\u529b\u306f\u3001\u65b0\u3057\u3044char\u914d\u5217\u304c\u30d1\u30b9\u30ef\u30fc\u30c9\u3068\u3044\u3046\u540d\u524d\u3067\u4f5c\u6210\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u73fe\u5728\u30016\u3064\u306e\u8981\u7d20\uff08[6]\uff09\u3092\u683c\u7d0d\u3067\u304d\u3001\u305d\u308c\u3089\u306f\u7a7a\u3067\u3059\uff08\\000\uff09\u3002<\/p>\n<p>\u3082\u3057\u304f\u306f\u3001\u65e2\u306b\u914d\u5217\u8981\u7d20\u3092\u77e5\u3063\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u3053\u306e\u3088\u3046\u306bchar\u8981\u7d20\u3092\u6301\u3064\u914d\u5217\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u305d\u306e\u914d\u5217\u3092\u30d1\u30b9\u30ef\u30fc\u30c9\u3068\u547c\u3073\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">char<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> password <span class=\"token operator\">=<\/span> new char<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> <mark><span class=\"token punctuation\">{<\/span><span class=\"token string\">&#8216;s&#8217;<\/span>, <span class=\"token string\">&#8216;e&#8217;<\/span>, <span class=\"token string\">&#8216;c&#8217;<\/span>, <span class=\"token string\">&#8216;r&#8217;<\/span>, <span class=\"token string\">&#8216;e&#8217;<\/span>, <span class=\"token string\">&#8216;t&#8217;<\/span><span class=\"token punctuation\">}<\/span><\/mark><span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>`\u30a4\u30b3\u30fc\u30eb`\u306e\u524d\u306b\u3042\u308b\u6587\u306e\u5de6\u5074\u306f\u3001\u6700\u521d\u306e\u7a7a\u306e\u914d\u5217\u306e\u4f8b\u3068\u540c\u3058\u304f\u3001`password`\u3068\u3044\u3046\u540d\u524d\u306echar\u914d\u5217\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u6587\u306e\u5f8c\u308d\u306e2\u756a\u76ee\u306e\u90e8\u5206\u306f\u3001\u518d\u3073`new`\u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u59cb\u307e\u308a\u307e\u3059\u304c\u3001\u8981\u7d20\u306e\u6570\u306f\u660e\u793a\u7684\u306b\u4e0e\u3048\u3089\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4ee3\u308f\u308a\u306b\u3001\u3059\u3079\u3066\u306e6\u3064\u306e\u8981\u7d20\u304c\u30ea\u30b9\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30ea\u30b9\u30c8\u306f\u958b\u304d\u304b\u3063\u3053\u304b\u3089\u59cb\u307e\u308a\u30016\u3064\u306e\u8981\u7d20\u304c\u7d9a\u304d\u307e\u3059\u3002\u8981\u7d20\u306fchar\u306e\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u306a\u306e\u3067\u3001\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\uff08&#8217;\uff09\u3067\u56f2\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u30ea\u30b9\u30c8\u306f\u9589\u3058\u304b\u3063\u3053\u3067\u7d42\u308f\u308a\u307e\u3059\u3002<\/p>\n<p>\u524d\u306e\u30b3\u30fc\u30c9\u3092jshell\u306b\u8cbc\u308a\u4ed8\u3051\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306a\u51fa\u529b\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>password ==&gt; char[6] { &#8216;s&#8217;, &#8216;e&#8217;, &#8216;c&#8217;, &#8216;r&#8217;, &#8216;e&#8217;, &#8216;t&#8217; }<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u51fa\u529b\u306f\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u6587\u5b57\u914d\u5217\u304c\u4f5c\u6210\u3055\u308c\u3001\u305d\u306e\u8981\u7d20\u304c\u30ea\u30b9\u30c8\u5316\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p>\u5f8c\u8005\u306e\u4f8b\u3067\u306f\u3001\u914d\u5217\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u8981\u7d20\u3092\u6307\u5b9a\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u8981\u7d20\u306b\u5024\u3092\u5272\u308a\u5f53\u3066\u308b\u305f\u3081\u306e\u8ffd\u52a0\u306e\u547d\u4ee4\u3092\u66f8\u304f\u5fc5\u8981\u304c\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u3002\u3053\u308c\u304c\u3001\u3053\u306e\u65b9\u6cd5\u3067\u914d\u5217\u3092\u4f5c\u6210\u3059\u308b\u5229\u70b9\u3067\u3059\u3002\u307e\u305f\u3001\u8981\u7d20\u3092\u500b\u5225\u306b\u5b9a\u7fa9\u3057\u305f\u5404\u8981\u7d20\u3067\u914d\u5217\u3092\u57cb\u3081\u308b\u305f\u3081\u306e\u30b3\u30fc\u30c9\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u6b21\u306b\u3053\u308c\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<h2>\u914d\u5217\u8981\u7d20\u306e\u6307\u5b9a\u3068\u5909\u66f4<\/h2>\n<p>\u914d\u5217\u306e\u8981\u7d20\u3092\u5e38\u306b\u628a\u63e1\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u306e\u3067\u3001\u914d\u5217\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u305d\u308c\u3089\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u914d\u5217\u306e\u8981\u7d20\u3092\u6700\u521d\u306b\u6307\u5b9a\u3057\u305f\u304b\u3069\u3046\u304b\u306b\u304b\u304b\u308f\u3089\u305a\u3001\u5f8c\u304b\u3089\u3044\u3064\u3067\u3082\u6307\u5b9a\u307e\u305f\u306f\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u914d\u5217\u306e\u8981\u7d20\u3092\u5909\u66f4\u3059\u308b\u5834\u5408\u3001\u305d\u306e\u8981\u7d20\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3001\u3064\u307e\u308a\u914d\u5217\u5185\u306e\u5834\u6240\u3092\u53c2\u7167\u3057\u3066\u6b21\u306e\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">password<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">=<\/span> <span class=\"token string\">&#8216;n&#8217;<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>password[0]\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001password\u914d\u5217\u306e\u6700\u521d\u306e\u8981\u7d20\u3092\u6307\u3059\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\u914d\u5217\u306e\u8981\u7d20\u306f0\u304b\u3089\u756a\u53f7\u304c\u3064\u3051\u3089\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u6700\u521d\u306e\u8981\u7d20\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f0\u306b\u306a\u308a\u307e\u3059\uff08\u3053\u306e\u5834\u5408\u3082\u540c\u69d8\u3067\u3059\uff09\u3002\u914d\u5217\u306e\u8981\u7d20\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u306f\u5e38\u306b\u89d2\u62ec\u5f27([])\u306e\u9593\u306b\u6307\u5b9a\u3055\u308c\u307e\u3059\u3002\u914d\u5217\u306e\u8981\u7d20\u3092\u518d\u5b9a\u7fa9\u3057\u3001\u65b0\u3057\u3044\u5024\uff08&#8217;n&#8217;\u3068\u3044\u3046char\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\uff09\u3092\u5272\u308a\u5f53\u3066\u307e\u3059\u3002<\/p>\n<p>jshell\u3067\u524d\u8ff0\u306e\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u51fa\u529b\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>$8 ==&gt; &#8216;n&#8217;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>jshell\u5185\u3067\u306f\u3001\u4e00\u6642\u5909\u6570$8\u304c\u4f7f\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u3042\u306a\u305f\u306e\u5834\u5408\u306b\u306f\u7570\u306a\u308b\u6570\u5024\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>jshell\u306b\u306f\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u914d\u5217\u304c\u610f\u56f3\u3057\u305f\u3088\u3046\u306b\u5909\u66f4\u3055\u308c\u305f\u304b\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3067\u304d\u308b\u30e6\u30cb\u30fc\u30af\u306a\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3068\u3044\u3046\u914d\u5217\u306e\u540d\u524d\u3092jshell\u306b\u8cbc\u308a\u4ed8\u3051\u308b\u3068\u3001\u8ffd\u52a0\u306e\u30e1\u30bd\u30c3\u30c9\u306a\u3057\u3067\u914d\u5217\u3068\u305d\u306e\u8981\u7d20\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">password<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30b8\u30a7\u30b7\u30a7\u30eb\u3067\u306f\u3001\u6b21\u306e\u3088\u3046\u306a\u51fa\u529b\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>password ==&gt; char[6] { &#8216;n&#8217;, &#8216;e&#8217;, &#8216;c&#8217;, &#8216;r&#8217;, &#8216;e&#8217;, &#8216;t&#8217; }<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u306e\u51fa\u529b\u306f\u3001\u914d\u5217\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092 s, e, c, r, e, t \u304b\u3089 n, e, c, r, e, t \u306b\u6b63\u5e38\u306b\u5909\u66f4\u3057\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059\u3002\u4eca\u5f8c\u3001\u3082\u3057\u653b\u6483\u8005\u304c\u30b5\u30fc\u30d0\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u5834\u5408\u3001\u5143\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3067\u306f\u306a\u304f\u5909\u66f4\u5f8c\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u3082\u3057\u30d1\u30b9\u30ef\u30fc\u30c9\u3092String\u5909\u6570\u306b\u4fdd\u5b58\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u65b0\u3057\u3044\u5024\u3092\u518d\u4ee3\u5165\u3057\u3066\u3082\u53e4\u3044\u5024\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u4e00\u5b9a\u6642\u9593\u30e1\u30e2\u30ea\u4e0a\u306b\u6b8b\u308a\u3001\u653b\u6483\u8005\u304c\u305d\u308c\u3092\u8aad\u3080\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306e\u9593\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u914d\u5217\u306f\u5f15\u304d\u7d9a\u304d\u4f7f\u7528\u3057\u307e\u3059\u306e\u3067\u3001\u4e00\u8cab\u6027\u3092\u4fdd\u3064\u305f\u3081\u306b\u3001\u518d\u5ea6\u53c2\u7167\u3057\u3066\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u3001\u6700\u521d\u306e\u8981\u7d20\u306e\u5024\u3092s\u306b\u623b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">password<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">=<\/span> <span class=\"token string\">&#8216;s&#8217;<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u308c\u306b\u3088\u308a\u3001\u4e00\u6642\u7684\u306a\u5909\u6570\u3092\u4f7f\u7528\u3057\u305f\u524d\u56de\u3068\u4f3c\u305f\u3088\u3046\u306a\u51fa\u529b\u304c\u5f97\u3089\u308c\u3001$25\u306e\u5834\u5408\u306f\u5909\u66f4\u304c\u6210\u529f\u3057\u305f\u3053\u3068\u304c\u78ba\u8a8d\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>$25 ==&gt; &#8216;s&#8217;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3082\u3046\u4e00\u5ea6\u3001\u5143\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u914d\u5217\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002\u8981\u7d20\u306f &#8216;s&#8217;\u3001&#8217;e&#8217;\u3001&#8217;c&#8217;\u3001&#8217;r&#8217;\u3001&#8217;e&#8217;\u3001&#8217;t&#8217;\u3067\u3059\u3002\u914d\u5217\u306e\u8981\u7d20\u306e\u4f5c\u6210\u3068\u5909\u66f4\u65b9\u6cd5\u3092\u77e5\u3063\u305f\u306e\u3067\u3001\u8981\u7d20\u3092\u8aad\u307f\u53d6\u3063\u3066\u4f7f\u7528\u3059\u308b\u6642\u304c\u6765\u307e\u3057\u305f\u3002<\/p>\n<h2>\u8981\u7d20\u3092\u53d6\u5f97\u3059\u308b\u3002<\/h2>\n<p>\u7279\u5b9a\u306e\u914d\u5217\u8981\u7d20\u3092\u53d6\u5f97\u3059\u308b\u969b\u306b\u306f\u3001\u305d\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u64cd\u4f5c\u3057\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u914d\u5217\u306e2\u756a\u76ee\u306e\u8981\u7d20\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u6b21\u306e\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">System.out.println<span class=\"token punctuation\">(<\/span>password<span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001println\uff08\uff09\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u914d\u5217\u306e2\u756a\u76ee\u306e\u8981\u7d20\u3092\u51fa\u529b\u3057\u307e\u3059\u3002\uff08System.out.println\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001\u5f53\u793e\u306eJava\u3067\u6700\u521d\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304f\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002\uff09\u914d\u5217\u306e\u8981\u7d20\u306f0\u304b\u3089\u59cb\u307e\u308b\u305f\u3081\u30012\u756a\u76ee\u306e\u8981\u7d20\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b91\u3092\u6301\u3061\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306a\u7d50\u679c\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>e<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u51fa\u529b\u306f\u30012\u756a\u76ee\u306e\u914d\u5217\u8981\u7d20e\u3092\u8868\u793a\u3057\u307e\u3059\u3002\u305d\u306e\u8981\u7d20\u3092\u8868\u793a\u3059\u308b\u3060\u3051\u3067\u306a\u304f\u3001char\u5024\u304c\u9069\u3057\u3066\u3044\u308b\u4ed6\u306e\u65b9\u6cd5\u3067\u3082\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3055\u3089\u306b\u3001Java\u306e\u30eb\u30fc\u30d7\u306e\u4f7f\u7528\u65b9\u6cd5\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u305f\u5f53\u793e\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u300cHow To Use Loops in Java\u300d\u306b\u5f93\u3044\u3001foreach\u30eb\u30fc\u30d7\u3092\u4f7f\u3046\u3053\u3068\u3067\u914d\u5217\u306e\u8981\u7d20\u3059\u3079\u3066\u306b\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u53ef\u80fd\u3067\u3059\u3002\u30eb\u30fc\u30d7\u306f\u3001\u53cd\u5fa9\u7684\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6d41\u308c\u3092\u5236\u5fa1\u3059\u308b\u305f\u3081\u306e\u69cb\u9020\u3067\u3042\u308a\u3001foreach\u30eb\u30fc\u30d7\u306f\u7279\u306b\u914d\u5217\u3092\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3059\u308b\u969b\u306b\u3001\u6700\u5c0f\u9650\u306e\u96db\u5f62\u30b3\u30fc\u30c9\u304c\u5fc5\u8981\u3067\u975e\u5e38\u306b\u4fbf\u5229\u3067\u3059\u3002\u4ee5\u4e0b\u306b\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\"><span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span>char c <span class=\"token builtin class-name\">:<\/span> password<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><\/li>\n<li data-prefix=\"jshell&gt;\">System.out.print<span class=\"token punctuation\">(<\/span>c<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<li data-prefix=\"jshell&gt;\"><span class=\"token punctuation\">}<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u306eforeach\u30eb\u30fc\u30d7\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u914d\u5217\u3092\u53cd\u5fa9\u51e6\u7406\u3057\u3001\u4e00\u6642\u7684\u306achar\u5909\u6570\u3067\u3042\u308bc\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u5404\u53cd\u5fa9\u3067\u306f\u3001c\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u914d\u5217\u306e\u6700\u521d\u304b\u3089\u6700\u5f8c\u306e\u8981\u7d20\u307e\u3067\u79fb\u52d5\u3057\u307e\u3059\u3002c\u304c\u914d\u5217\u8981\u7d20\u306e\u5024\u3092\u53d6\u5f97\u3059\u308b\u3068\u3001\u30b3\u30fc\u30c9\u306e\u30d6\u30ed\u30c3\u30af\u5185\u3067c\u3092\u9069\u5207\u306b\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u524d\u306e\u4f8b\u3067\u306f\u3001print\uff08\uff09\u30e1\u30bd\u30c3\u30c9\u3067c\u3092\u51fa\u529b\u3057\u307e\u3059\u3002<\/p>\n<p>print()\u30e1\u30bd\u30c3\u30c9\u306f\u6539\u884c\u306a\u3057\u3067\u5f15\u6570\u3092\u51fa\u529b\u3059\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u4e00\u65b9\u3001\u3053\u308c\u307e\u3067\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001println()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u304a\u308a\u3001\u5b9f\u884c\u6642\u306b\u306f\u6539\u884c\u304c\u884c\u308f\u308c\u307e\u3059\u3002\u3053\u306e\u5834\u5408\u3001password\u914d\u5217\u306e\u8981\u7d20\u3092\u3059\u3079\u3066\u540c\u3058\u884c\u306b\u51fa\u529b\u3059\u308b\u305f\u3081\u306b\u306f\u3001print()\u30e1\u30bd\u30c3\u30c9\u304c\u3088\u308a\u9069\u3057\u3066\u304a\u308a\u3001\u7d50\u679c\u306f\u5358\u8a9e\u3068\u3057\u3066\u3088\u308a\u826f\u304f\u8996\u899a\u5316\u3055\u308c\u307e\u3059\uff08\u300csecret\u300d\uff09\u3002<\/p>\n<p>\u3082\u3057\u524d\u8ff0\u306e\u624b\u9806\u3092\u6b63\u78ba\u306b\u5b88\u308a\u3001\u3053\u306e\u30b3\u30fc\u30c9\u3092jshell\u3067\u5b9f\u884c\u3059\u308c\u3070\u3001\u4ee5\u4e0b\u306e\u51fa\u529b\u7d50\u679c\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>secret<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u6700\u521d\u306e\u914d\u5217\u8981\u7d20\u3092n\u304b\u3089s\u306b\u30ea\u30bb\u30c3\u30c8\u3059\u308b\u30b9\u30c6\u30c3\u30d7\u3092\u9003\u3059\u3068\u3001\u4ee3\u308f\u308a\u306bnecret\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<p>\u3042\u306a\u305f\u304c\u3053\u308c\u307e\u3067\u306b\u7bc9\u3044\u3066\u304d\u305f\u77e5\u8b58\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3068\u3001\u914d\u5217\u306e\u8981\u7d20\u3092\u3059\u3079\u3066\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u4ee5\u964d\u306f\u3001\u914d\u5217\u306b\u3064\u3044\u3066\u3055\u3089\u306b\u6df1\u304f\u6398\u308a\u4e0b\u3052\u3001\u3055\u307e\u3056\u307e\u306a\u6a5f\u80fd\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306e\u4fbf\u5229\u306a\u914d\u5217\u30e1\u30bd\u30c3\u30c9\u3092\u5b66\u3076\u6e96\u5099\u304c\u6574\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u914d\u5217\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b<\/h2>\n<p>Java\u306b\u306f\u3001java.util\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u3042\u308b\u975e\u5e38\u306b\u4fbf\u5229\u306aArrays\u30af\u30e9\u30b9\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u30af\u30e9\u30b9\u306f\u3001\u914d\u5217\u3092\u6271\u3046\u969b\u306b\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u3092\u63d0\u4f9b\u3059\u308b\u3053\u3068\u3067\u3001\u4e00\u822c\u7684\u306a\u4f7f\u7528\u30b1\u30fc\u30b9\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002\u3064\u307e\u308a\u3001\u8eca\u8f2a\u306e\u518d\u767a\u660e\u3092\u3057\u306a\u304f\u3066\u3082\u3001\u91cd\u8907\u3057\u305f\u52aa\u529b\u3092\u7701\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u3001\u6700\u3082\u983b\u7e41\u306b\u4f7f\u7528\u3055\u308c\u308b\u30e1\u30bd\u30c3\u30c9\u306e\u3044\u304f\u3064\u304b\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<h3>equals\uff08\uff09\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>equals()\u30e1\u30bd\u30c3\u30c9\u306f\u30012\u3064\u306e\u914d\u5217\u304c\u7b49\u3057\u3044\u304b\u3069\u3046\u304b\u3092\u6bd4\u8f03\u3057\u307e\u3059\u30022\u3064\u306e\u914d\u5217\u304c\u7b49\u3057\u3044\u305f\u3081\u306b\u306f\u3001\u540c\u3058\u9577\u3055\u3001\u8981\u7d20\u3001\u9806\u5e8f\u3092\u6301\u3063\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u30d1\u30b9\u30ef\u30fc\u30c9\u914d\u5217\u306e\u4f8b\u3067\u7d9a\u3051\u308b\u3068\u3001n\u3001o\u3001n\u3001e\u3068\u3044\u3046\u6587\u5b57\u3092\u542b\u3080password2\u3068\u3044\u30462\u756a\u76ee\u306e\u914d\u5217\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">char<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> password2 <span class=\"token operator\">=<\/span> new char<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token string\">&#8216;n&#8217;<\/span>, <span class=\"token string\">&#8216;o&#8217;<\/span>, <span class=\"token string\">&#8216;n&#8217;<\/span>, <span class=\"token string\">&#8216;e&#8217;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>jshell\u3067\u3053\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u78ba\u8a8d\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>password2 ==&gt; char[4] { &#8216;n&#8217;, &#8216;o&#8217;, &#8216;n&#8217;, &#8216;e&#8217; }<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u51fa\u529b\u306f\u3001password2\u914d\u5217\u3092\u6301\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u305d\u308c\u306f4\u3064\u306e\u8981\u7d20\u3092\u6301\u3061\u3001\u305d\u308c\u3089\u3082\u51fa\u529b\u3055\u308c\u307e\u3059\u3002\u4ee5\u524d\u306ejshell\u30bb\u30c3\u30b7\u30e7\u30f3\u3092\u7d42\u4e86\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u5143\u306epassword\u914d\u5217\u3082\u6301\u3063\u3066\u3044\u307e\u3059\u3002jshell\u30bb\u30c3\u30b7\u30e7\u30f3\u3092\u7d42\u4e86\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001password\u914d\u5217\u3092\u518d\u4f5c\u6210\u3059\u308b\u305f\u3081\u306eCreating Arrays\u306e\u624b\u9806\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u6bd4\u8f03\u3067\u304d\u308b2\u3064\u306e\u914d\u5217\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u4eca\u3001\u3053\u306e\u3088\u3046\u306b2\u3064\u306e\u914d\u5217\u3092\u6bd4\u8f03\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">System.out.println<span class=\"token punctuation\">(<\/span>Arrays.equals<span class=\"token punctuation\">(<\/span>password, password2<span class=\"token punctuation\">))<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u524d\u306e\u884c\u3067\u306f\u3001password\u3068password2\u306e\u914d\u5217\u3092\u6bd4\u8f03\u3059\u308bArray.equal()\u30e1\u30bd\u30c3\u30c9\u306e\u7d50\u679c\u3092println()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u51fa\u529b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>2\u3064\u306e\u914d\u5217\u304c\u7570\u306a\u308b\u306e\u3067\u3001\u7d50\u679c\u306ffalse\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>false<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u51fa\u529b\u306e\u300cfalse\u300d\u306f\u3001\u4e8c\u3064\u306e\u914d\u5217\u304c\u7b49\u3057\u304f\u306a\u3044\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u7df4\u7fd2\u3068\u3057\u3066\u3001\u4ed6\u306e\u914d\u5217\u3092\u4f5c\u6210\u3057\u3066\u6bd4\u8f03\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u3082\u3057\u4e8c\u3064\u306e\u914d\u5217\u304c\u7b49\u3057\u3044\u5834\u5408\u306f\u3001\u300ctrue\u300d\u306e\u7d50\u679c\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<h3>\u30bd\u30fc\u30c8()\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>sort()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u914d\u5217\u306e\u8981\u7d20\u3092\u6607\u9806\u306b\u4e26\u3079\u66ff\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3068\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u914d\u5217\u306e\u6587\u5b57\u3092\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u9806\u306b\u4e26\u3079\u66ff\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">Arrays.sort<span class=\"token punctuation\">(<\/span>password<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u305d\u306e\u5f8c\u3001\u305d\u306e\u914d\u5217\u306e\u540d\u524d\u3092jshell\u3067\u767a\u884c\u3059\u308b\u3053\u3068\u3067\u3001\u5909\u66f4\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u518d\u5ea6\u914d\u5217\u3092\u5370\u5237\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">password<span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>jshell\u306e\u51fa\u529b\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>password ==&gt; char[6] { &#8216;c&#8217;, &#8216;e&#8217;, &#8216;e&#8217;, &#8216;r&#8217;, &#8216;s&#8217;, &#8216;t&#8217; }<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u308c\u306b\u3088\u308a\u3001\u914d\u5217\u306f\u307e\u3060\u540c\u3058\u8981\u7d20\u3092\u6301\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3055\u308c\u307e\u3057\u305f\u304c\u3001\u305d\u306e\u9806\u5e8f\u304c\u5909\u308f\u308a\u307e\u3057\u305f\u3002\u914d\u5217\u306e\u8981\u7d20\u306f\u3001&#8217;s&#8217;\u3001&#8217;e&#8217;\u3001&#8217;c&#8217;\u3001&#8217;r&#8217;\u3001&#8217;e&#8217;\u3001&#8217;t&#8217;\u304b\u3089&#8217;c&#8217;\u3001&#8217;e&#8217;\u3001&#8217;e&#8217;\u3001&#8217;r&#8217;\u3001&#8217;s&#8217;\u3001&#8217;t&#8217;\u306b\u4e26\u3073\u66ff\u3048\u3089\u308c\u307e\u3057\u305f\u3002\u3053\u306e\u3088\u3046\u306b\u914d\u5217\u306e\u9806\u5e8f\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u306f\u3001\u5143\u306e\u9806\u5e8f\u304c\u91cd\u8981\u306a\u5834\u5408\u306b\u306f\u826f\u3044\u8003\u3048\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5834\u5408\u3068\u540c\u69d8\u306b\u3001\u9806\u5e8f\u3092\u5909\u66f4\u3059\u308b\u3068\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u5143\u306e\u3082\u306e\u3068\u7570\u306a\u308a\u3001\u6a5f\u80fd\u3057\u307e\u305b\u3093\u3002\u305f\u3060\u3057\u3001\u4ed6\u306e\u7528\u9014\u3067\u306f\u3001\u914d\u5217\u8981\u7d20\u306e\u9806\u5e8f\u304c\u91cd\u8981\u3067\u306f\u306a\u3044\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u3057\u3001\u521d\u671f\u306e\u4e26\u3079\u66ff\u3048\u304c\u5fc5\u8981\u306a\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306b\u3064\u3044\u3066\u306f\u6b21\u306b\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30d0\u30a4\u30ca\u30ea\u30b5\u30fc\u30c1()\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>binarySearch()\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u6307\u5b9a\u3055\u308c\u305f\u5024\u3092\u6301\u3064\u914d\u5217\u306e\u8981\u7d20\u3092\u691c\u7d22\u3057\u307e\u3059\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306e\u7279\u7570\u6027\u306e\u4e00\u3064\u306f\u3001\u6700\u521d\u306b\u914d\u5217\u306e\u8981\u7d20\u304c\u30bd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308b\u3053\u3068\u3067\u3059\u3002\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u3001\u4e88\u671f\u3057\u306a\u3044\u7d50\u679c\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u914d\u5217\u3092\u30bd\u30fc\u30c8\u3057\u305f\u5f8c\u3001\u8981\u7d20\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u898b\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u4e2d\u3067\u6587\u5b57c\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u898b\u3064\u3051\u3066\u3001\u305d\u308c\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">System.out.println<span class=\"token punctuation\">(<\/span>Arrays.binarySearch<span class=\"token punctuation\">(<\/span>password, <span class=\"token string\">&#8216;c&#8217;<\/span><span class=\"token punctuation\">))<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u308c\u306b\u3088\u3063\u3066\u751f\u3058\u308b\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>0<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u914d\u5217\u304c\u30bd\u30fc\u30c8\u3055\u308c\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u601d\u3044\u51fa\u3057\u3066\u304f\u3060\u3055\u3044: &#8216;c&#8217;, &#8216;e&#8217;, &#8216;e&#8217;, &#8216;r&#8217;, &#8216;s&#8217;, &#8216;t&#8217;\u3002\u6570\u5b570\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u6587\u5b57&#8217;c&#8217;\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b90\u3092\u6301\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u3059\u3002\u306a\u305c\u306a\u3089\u3001\u3053\u308c\u306f\u914d\u5217\u306e\u6700\u521d\u306e\u8981\u7d20\u3060\u304b\u3089\u3067\u3059\u3002<\/p>\n<h3>\u300ccopyOf()\u300d\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>copyOf\uff08\uff09\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u914d\u5217\u306e\u30b5\u30a4\u30ba\u3092\u5897\u6e1b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u306b\u3001\u6307\u5b9a\u3055\u308c\u305f\u914d\u5217\u3092\u65b0\u3057\u3044\u914d\u5217\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002\u914d\u5217\u306e\u9577\u3055\u306f\u4f5c\u6210\u5f8c\u306b\u5909\u66f4\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u65e7\u914d\u5217\u304b\u3089\u30b3\u30d4\u30fc\u3055\u308c\u305f\u5185\u5bb9\u3092\u542b\u3080\u5fc5\u8981\u306a\u30b5\u30a4\u30ba\u306e\u65b0\u3057\u3044\u914d\u5217\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305f\u3068\u3048\u3070\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u914d\u5217\u306f\u73fe\u4ee3\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8981\u4ef6\u306b\u306f\u9069\u3055\u306a\u3044\u305f\u3081\u3001\u53ea\u4eca\u3001\uff16\u3064\u306e\u8981\u7d20\u3057\u304b\u4fdd\u5b58\u3067\u304d\u307e\u305b\u3093\u3002\u305d\u306e\u30b5\u30a4\u30ba\u3092\u5897\u3084\u3059\u305f\u3081\u306b\u306f\u3001\u6b21\u306e\u3088\u3046\u306bcopyOf()\u3092\u4f7f\u7528\u3057\u3066\u65b0\u3057\u3044\u5927\u304d\u306a\u914d\u5217\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">password <span class=\"token operator\">=<\/span> Arrays.copyOf<span class=\"token punctuation\">(<\/span>password, <span class=\"token number\">10<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u524d\u306e\u4f8b\u3067\u306f\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5024\u3092\u65b0\u3057\u3044\u914d\u5217\u306b\u518d\u5272\u308a\u5f53\u3066\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u65b0\u3057\u3044\u914d\u5217\u306f\u3001\u53e4\u3044\u30d1\u30b9\u30ef\u30fc\u30c9\u914d\u5217\u3092\u8981\u7d20\u657010\u306e\u65b0\u3057\u3044\u914d\u5217\u306b\u30b3\u30d4\u30fc\u3057\u305f\u7d50\u679c\u3067\u3059\u3002\u30b3\u30d4\u30fc\u3059\u308b\u305f\u3081\u306b\u3001Arrays.copyOf()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u307e\u3057\u305f\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u30012\u3064\u306e\u5f15\u6570\u3092\u53d7\u3051\u53d6\u308a\u307e\u3059\u3002\u6700\u521d\u306e\u5f15\u6570\u306f\u30b3\u30d4\u30fc\u5143\u306e\u914d\u5217\u3067\u3059\u30022\u756a\u76ee\u306e\u5f15\u6570\u306f\u4f5c\u6210\u3059\u308b\u65b0\u3057\u3044\u914d\u5217\u306e\u9577\u3055\u3067\u3059\u3002<\/p>\n<p>\u524d\u8ff0\u306e\u30b3\u30fc\u30c9\u3092jshell\u3067\u5b9f\u884c\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306a\u51fa\u529b\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>password ==&gt; char[10] { &#8216;c&#8217;, &#8216;e&#8217;, &#8216;e&#8217;, &#8216;r&#8217;, &#8216;s&#8217;, &#8216;t&#8217;, &#8216;\\000&#8217;, &#8216;\\000&#8217;, &#8216;\\000&#8217;, &#8216;\\000&#8217; }<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u524d\u306e\u884c\u306f\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u914d\u5217\u304c\u73fe\u572810\u3064\u306e\u8981\u7d20\u3092\u6301\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u6700\u521d\u306e6\u3064\u306e\u8981\u7d20\u306f\u3001\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u9806\u306b\u4e26\u3079\u66ff\u3048\u3089\u308c\u305f\u5143\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u914d\u5217\u304b\u3089\u6765\u3066\u304a\u308a\u3001&#8217;c&#8217;\u3001&#8217;e&#8217;\u3001&#8217;e&#8217;\u3001&#8217;r&#8217;\u3001&#8217;s&#8217;\u3001&#8217;t&#8217;\u3068\u306a\u308a\u307e\u3057\u305f\u3002\u6700\u5f8c\u306e4\u3064\u306e\u5024\u306f\u7a7a\u3067\u3059\u3002\u306a\u305c\u306a\u3089\u3001Arrays.copyOf\uff08\uff09\u306f\u8981\u7d20\u6570\u3092\u5897\u3084\u3059\u969b\u306b\u65b0\u3057\u3044\u8981\u7d20\u3092\u7a7a\u3067\u57cb\u3081\u308b\u305f\u3081\u3067\u3059\u3002<\/p>\n<p>\u666e\u901a\u306e\u65b9\u6cd5\u3067\u3001\u914d\u5217\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u6301\u3064\u9577\u3055\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3067\u3001\u65b0\u3057\u3044\u914d\u5217\u304c10\u306e\u8981\u7d20\u3092\u6301\u3064\u3053\u3068\u3082\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u5024\u306f\u901a\u5e38\u306e\u65b9\u6cd5\u3067\u51fa\u529b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"jshell&gt;\">System.out.println<span class=\"token punctuation\">(<\/span>password.length<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u3053\u3067\u306f\u3001println() \u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3001password.length \u3092\u5f15\u6570\u3068\u3057\u3066\u6e21\u3057\u307e\u3059\u3002jshell \u304b\u3089\u306e\u51fa\u529b\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>10<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u53d6\u308a\u4e0a\u3052\u3089\u308c\u305f\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u914d\u5217\u306b\u95a2\u9023\u3059\u308b\u3082\u306e\u306e\u4e2d\u3067\u3082\u975e\u5e38\u306b\u6709\u7528\u306a\u3082\u306e\u3067\u3059\u3002\u516c\u5f0f\u306eArrays\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u53c2\u8003\u306b\u3057\u3066\u3001\u3055\u307e\u3056\u307e\u306a\u30e1\u30bd\u30c3\u30c9\u3092\u81ea\u5206\u81ea\u8eab\u3067\u63a2\u7d22\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u7d50\u8ad6<\/h2>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u95a2\u9023\u3059\u308b\u30a2\u30a4\u30c6\u30e0\u3092\u30b0\u30eb\u30fc\u30d7\u5316\u3059\u308b\u305f\u3081\u306bJava\u306e\u914d\u5217\u3092\u4f7f\u7528\u3057\u307e\u3057\u305f\u3002\u914d\u5217\u306e\u4f5c\u6210\u65b9\u6cd5\u3001\u8868\u793a\u65b9\u6cd5\u3001\u304a\u3088\u3073\u305d\u306e\u5185\u5bb9\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u5b66\u3073\u307e\u3057\u305f\u3002\u307e\u305f\u3001\u914d\u5217\u3092\u6271\u3046\u305f\u3081\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3068\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u3082\u5b66\u3073\u307e\u3057\u305f\u3002<\/p>\n<p>Java\u306b\u3064\u3044\u3066\u306f\u3001\u5f0a\u793e\u306eJava\u3067\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u30b7\u30ea\u30fc\u30ba\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30a4\u30f3\u30c8\u30ed\u30c0\u30af\u30b7\u30e7\u30f3 \u914d\u5217\u306f\u3001\u8907\u6570\u306e\u8981\u7d20\u3092\u30b0\u30eb\u30fc\u30d7\u5316\u3057\u3066\u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u914d\u5217\u3092\u4f7f\u3048\u3070\u3001\u53c2\u7167\u578b\u3084\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u3092\u542b\u3080\u3069\u3093\u306a\u7a2e\u985e\u306e\u30c7\u30fc\u30bf\u3067\u3082\u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u3059\u3079\u3066\u306e\u914d\u5217\u8981\u7d20\u306f\u540c\u3058\u30c7\u30fc\u30bf\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[42,56,26,57],"class_list":["post-15","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-java","tag-javascript","tag-26","tag-57"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\uff1a\u5b8c\u5168\u30ac\u30a4\u30c92025\u5e74\u7248 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\u3092\u5b8c\u5168\u89e3\u8aac\u3002\u914d\u5217\u306e\u4f5c\u6210\u3001\u8981\u7d20\u306e\u64cd\u4f5c\u3001\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u307e\u3067\u3001\u521d\u5fc3\u8005\u306b\u3082\u308f\u304b\u308a\u3084\u3059\u304f\u8aac\u660e\u3057\u307e\u3059\u30022025\u5e74\u6700\u65b0\u7248\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\uff1a\u5b8c\u5168\u30ac\u30a4\u30c92025\u5e74\u7248\" \/>\n<meta property=\"og:description\" content=\"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\u3092\u5b8c\u5168\u89e3\u8aac\u3002\u914d\u5217\u306e\u4f5c\u6210\u3001\u8981\u7d20\u306e\u64cd\u4f5c\u3001\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u307e\u3067\u3001\u521d\u5fc3\u8005\u306b\u3082\u308f\u304b\u308a\u3084\u3059\u304f\u8aac\u660e\u3057\u307e\u3059\u30022025\u5e74\u6700\u65b0\u7248\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-26T13:05:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T00:32:58+00:00\" \/>\n<meta name=\"author\" content=\"\u685c, \u6625\u6a39\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u685c, \u6625\u6a39\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"21\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/\",\"name\":\"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\uff1a\u5b8c\u5168\u30ac\u30a4\u30c92025\u5e74\u7248 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2023-07-26T13:05:40+00:00\",\"dateModified\":\"2025-07-31T00:32:58+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341\"},\"description\":\"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\u3092\u5b8c\u5168\u89e3\u8aac\u3002\u914d\u5217\u306e\u4f5c\u6210\u3001\u8981\u7d20\u306e\u64cd\u4f5c\u3001\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u307e\u3067\u3001\u521d\u5fc3\u8005\u306b\u3082\u308f\u304b\u308a\u3084\u3059\u304f\u8aac\u660e\u3057\u307e\u3059\u30022025\u5e74\u6700\u65b0\u7248\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\uff1a\u5b8c\u5168\u30ac\u30a4\u30c92025\u5e74\u7248\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341\",\"name\":\"\u685c, \u6625\u6a39\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g\",\"caption\":\"\u685c, \u6625\u6a39\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/sakuraharuki\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\uff1a\u5b8c\u5168\u30ac\u30a4\u30c92025\u5e74\u7248 - Blog - Silicon Cloud","description":"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\u3092\u5b8c\u5168\u89e3\u8aac\u3002\u914d\u5217\u306e\u4f5c\u6210\u3001\u8981\u7d20\u306e\u64cd\u4f5c\u3001\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u307e\u3067\u3001\u521d\u5fc3\u8005\u306b\u3082\u308f\u304b\u308a\u3084\u3059\u304f\u8aac\u660e\u3057\u307e\u3059\u30022025\u5e74\u6700\u65b0\u7248\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\/","og_locale":"ja_JP","og_type":"article","og_title":"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\uff1a\u5b8c\u5168\u30ac\u30a4\u30c92025\u5e74\u7248","og_description":"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\u3092\u5b8c\u5168\u89e3\u8aac\u3002\u914d\u5217\u306e\u4f5c\u6210\u3001\u8981\u7d20\u306e\u64cd\u4f5c\u3001\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u307e\u3067\u3001\u521d\u5fc3\u8005\u306b\u3082\u308f\u304b\u308a\u3084\u3059\u304f\u8aac\u660e\u3057\u307e\u3059\u30022025\u5e74\u6700\u65b0\u7248\u3002","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-07-26T13:05:40+00:00","article_modified_time":"2025-07-31T00:32:58+00:00","author":"\u685c, \u6625\u6a39","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u685c, \u6625\u6a39","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"21\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/","name":"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\uff1a\u5b8c\u5168\u30ac\u30a4\u30c92025\u5e74\u7248 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2023-07-26T13:05:40+00:00","dateModified":"2025-07-31T00:32:58+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341"},"description":"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\u3092\u5b8c\u5168\u89e3\u8aac\u3002\u914d\u5217\u306e\u4f5c\u6210\u3001\u8981\u7d20\u306e\u64cd\u4f5c\u3001\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u307e\u3067\u3001\u521d\u5fc3\u8005\u306b\u3082\u308f\u304b\u308a\u3084\u3059\u304f\u8aac\u660e\u3057\u307e\u3059\u30022025\u5e74\u6700\u65b0\u7248\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"Java\u3067\u306e\u914d\u5217\u306e\u4f7f\u3044\u65b9\uff1a\u5b8c\u5168\u30ac\u30a4\u30c92025\u5e74\u7248"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/ff22288af1a5455571aff7586b0fb341","name":"\u685c, \u6625\u6a39","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cee48863f3d4fd7fef222498f3e71b82312aee42b7257a2dbde56394ca4e19de?s=96&d=mm&r=g","caption":"\u685c, \u6625\u6a39"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/sakuraharuki\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/java%e3%81%a7%e3%81%ae%e9%85%8d%e5%88%97%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/15","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":5,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"predecessor-version":[{"id":325634,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/15\/revisions\/325634"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}