{"id":1517,"date":"2019-03-22T17:00:49","date_gmt":"2019-03-22T08:00:49","guid":{"rendered":"https:\/\/www.bold.ne.jp\/engineer-club\/?p=1517"},"modified":"2025-10-06T17:25:03","modified_gmt":"2025-10-06T08:25:03","slug":"java-char","status":"publish","type":"post","link":"https:\/\/www.bold.ne.jp\/engineer-club\/java-char","title":{"rendered":"Java\u306echar\u3068\u306f\uff1fString\u3068\u306e\u95a2\u4fc2\u6027\u3084char\u306e\u4f7f\u3044\u65b9\u3092\u89e3\u8aac"},"content":{"rendered":"<p><strong>Java\u306echar\u306f16\u30d3\u30c3\u30c8(2\u30d0\u30a4\u30c8)\u306e\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u3067\u3001Unicode\u3068\u3044\u3046\u6587\u5b57\u30b3\u30fc\u30c9\u898f\u683c\u3067\u306e\u4e00\u6587\u5b57\u3092\u30010\uff5e65,535\u306e\u7bc4\u56f2\u306e\u6570\u5b57\u3067\u8868\u3057\u305f\u3082\u306e\u3067\u3059\u3002<\/strong><br \/>\n\u30d7\u30ed\u30b0\u30e9\u30e0\u3084\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u3067\u306f\u3001\u6587\u5b57\u3082\u6570\u5b57\u3067\u8868\u3057\u307e\u3059\u306e\u3067\u3001<span>char<\/span>\u304c<span>Java<\/span>\u3067\u6587\u5b57\u3092\u6271\u3046\u6642\u306e\u6700\u5c0f\u5358\u4f4d\u3067\u3059\u3002<\/p>\n<p>char\u306f\u6570\u5b57\u3067\u3082\u3042\u308a\u6587\u5b57\u3067\u3082\u3042\u308a\u307e\u3059\u3002\u3067\u3059\u306e\u3067\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u4e0a\u3067<span>char<\/span>\u3092\u8868\u73fe\u3067\u304d\u308b\u66f8\u304d\u65b9\u306f\u3044\u308d\u3044\u308d\u3042\u3063\u3066\u3001\u6587\u5b57\u305d\u306e\u3082\u306e\u3001<span>2<\/span>\u9032\u6570\u3001<span>10<\/span>\u9032\u6570\u3001<span>16<\/span>\u9032\u6570\u3001<span>Unicode<\/span>\u306e\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u306a\u3069\u304c\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<p>Java\u306e\u6587\u5b57\u5217\u3067\u3042\u308b<span>String<\/span>\u306f\u3001<span>char<\/span>\u304c\u96c6\u307e\u3063\u3066\u3067\u304d\u305f\u3082\u306e\u3068\u3082\u8a00\u3048\u308b\u306e\u3067\u3001<span>char<\/span>\u3068<span>String<\/span>\u306f\u5927\u5909\u95a2\u9023\u306e\u6df1\u3044\u9593\u67c4\u3067\u3059\u3002\u3067\u3059\u306e\u3067\u3001<span>char<\/span>\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u306f<span>String<\/span>\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u306b\u3082\u3064\u306a\u304c\u308a\u3001\u3086\u304f\u3086\u304f\u306f<span>Unicode<\/span>\u306e\u7406\u89e3\u306b\u3082\u3064\u306a\u304c\u3063\u3066\u3044\u304f\u5927\u4e8b\u306a\u3053\u3068\u306a\u306e\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001<span>Java<\/span>\u306e<span>char<\/span>\u306b\u3064\u3044\u3066\u3001<span class=\"f-marker-p\">\u305d\u3082\u305d\u3082char\u3068\u306f\u3069\u3046\u3044\u3046\u3082\u306e\u304b<\/span>\u3068\u3044\u3046\u57fa\u790e\u304b\u3089\u3001\u3058\u3063\u304f\u308a\u3068\u304a\u4f1d\u3048\u3057\u307e\u3059\u3002\u3082\u3061\u308d\u3093\u3001<span>String<\/span>\u3068\u306e\u76f8\u4e92\u5909\u63db\u306e\u4ed5\u65b9\u306a\u3069\u3001\u4fbf\u5229\u306a\u77e5\u8b58\u3082\u76db\u308a\u3060\u304f\u3055\u3093\u3067\u3059\u3002<\/p>\n<p>\u203b\u3053\u306e\u8a18\u4e8b\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u3001<span>Java 11<\/span>\u306e\u74b0\u5883\u3067\u52d5\u4f5c\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059<\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">\u76ee\u6b21<\/p><ul class=\"toc_list\"><li><a href=\"#JavacharUnicode065535\">\uff11\uff0e\u3010Java\u3011char\u306fUnicode\u306e\u4e00\u6587\u5b57\u3092\u8868\u30590\uff5e65535\u306e\u6570\u5b57<\/a><ul><li><a href=\"#i\">\uff11-\uff11\uff0e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306f\u6587\u5b57\u3082\u6570\u5b57\u3067\u8868\u73fe\u3059\u308b<\/a><\/li><li><a href=\"#-charString\">\uff11-\uff12\uff0echar\u3068String\u306f\u9060\u304f\u3066\u8fd1\u3044\u30e2\u30ce<\/a><\/li><\/ul><\/li><li><a href=\"#Javachar\">\uff12\uff0e\u3010Java\u3011char\u306e\u4f7f\u3044\u65b9<\/a><ul><li><a href=\"#-char\">\uff12-\uff11\uff0echar\u306e\u5ba3\u8a00\u3068\u4ee3\u5165<\/a><\/li><li><a href=\"#-char-2\">\uff12-\uff12\uff0echar\u306e\u30ea\u30c6\u30e9\u30eb\u8868\u73fe\u306e\u3044\u308d\u3044\u308d<\/a><\/li><li><a href=\"#-char-3\">\uff12-\uff13\uff0echar\u306f==\u3067\u6bd4\u8f03\u3059\u308b<\/a><\/li><\/ul><\/li><li><a href=\"#JavacharString\">\uff13\uff0e\u3010Java\u3011char\u3068String\u306e\u4f7f\u3044\u65b9\u3044\u308d\u3044\u308d<\/a><ul><li><a href=\"#-charString-2\">\uff13-\uff11\uff0echar\u3092String\u306b\u5909\u63db\u3059\u308b<\/a><\/li><li><a href=\"#-charString-3\">\uff13-\uff12\uff0e\u8907\u6570\u306echar\u3092\u4e00\u3064\u306eString\u306b\u5909\u63db\u3059\u308b<\/a><\/li><li><a href=\"#-charString-4\">\uff13-\uff13\uff0echar\u306e\u914d\u5217\u3092String\u306b\u5909\u63db\u3059\u308b<\/a><\/li><li><a href=\"#-Stringchar\">\uff13-\uff14\uff0eString\u304b\u3089\u6307\u5b9a\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306echar\u3092\u53d6\u5f97\u3059\u308b<\/a><\/li><li><a href=\"#-Stringchar-2\">\uff13-\uff15\uff0eString\u3092char\u306e\u914d\u5217\u306b\u5909\u63db\u3059\u308b<\/a><\/li><li><a href=\"#-Stringchar-3\">\uff13-\uff16\uff0eString\u3068char\u3092\u9023\u7d50\u3059\u308b<\/a><\/li><li><a href=\"#-char210816\">\uff13-\uff17\uff0echar\u30922\u9032\u6570\u300110\u9032\u6570\u30018\u9032\u6570\u300116\u9032\u6570\u306e\u6587\u5b57\u5217\u306b\u5909\u63db\u3059\u308b<\/a><\/li><\/ul><\/li><li><a href=\"#charCharacter\">\uff15\uff0echar\u3068Character<\/a><ul><li><a href=\"#i-2\">\uff15-\uff11\uff0e\u4e8c\u7a2e\u985e\u306e\u8868\u73fe\u65b9\u6cd5\u306f\u6027\u80fd\u78ba\u4fdd\u306e\u305f\u3081<\/a><\/li><li><a href=\"#-Characternull\">\uff15-\uff12\uff0e\u30af\u30e9\u30b9\u306eCharacter\u306a\u3089null\u3092\u8868\u73fe\u3067\u304d\u308b<\/a><\/li><li><a href=\"#-charCharacter\">\uff15-\uff13\uff0e\u30aa\u30fc\u30c8\u30dc\u30af\u30b7\u30f3\u30b0\u3067char\u3068Character\u3092\u81ea\u52d5\u5909\u63db\u3059\u308b<\/a><\/li><\/ul><\/li><li><a href=\"#i-3\">\uff15\uff0e\u307e\u3068\u3081<\/a><\/li><\/ul><\/div>\n<h2><span id=\"JavacharUnicode065535\">\uff11\uff0e\u3010Java\u3011char\u306f<span>Unicode<\/span>\u306e\u4e00\u6587\u5b57\u3092\u8868\u3059<span>0<\/span>\uff5e<span>65535<\/span>\u306e\u6570\u5b57<\/span><\/h2>\n<p><strong>Java\u306echar\u306f16\u30d3\u30c3\u30c8(2\u30d0\u30a4\u30c8)\u306e\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b(primitive\u3001\u57fa\u672c\u30c7\u30fc\u30bf\u578b)\u3067\u3001Unicode(\u30e6\u30cb\u30b3\u30fc\u30c9)\u3068\u3044\u3046\u6587\u5b57\u30b3\u30fc\u30c9\u898f\u683c\u3067\u306e\u4e00\u6587\u5b57\u3092\u30010\uff5e65535\u306e\u7bc4\u56f2\u306e\u6574\u6570\u3067\u8868\u3059\u3082\u306e\u3067\u3059\u3002<\/strong><\/p>\n<p>char\u306f\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u3067\u3059\u306e\u3067\u300c\u6570\u5b57\u305d\u306e\u3082\u306e\u300d\u3067\u3059\u3002\u3067\u3059\u304b\u3089\u3001\u4f55\u304b\u306e\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u30af\u30e9\u30b9\u3068\u3057\u3066<span>char<\/span>\u3092\u8868\u73fe\u3059\u308b\u5834\u5408\u306f\u3001<span>Java<\/span>\u3067\u306f<span>Character<\/span>\u3068\u3044\u3046\u30af\u30e9\u30b9\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>char\u3068\u4ed6\u306e\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u3092\u6bd4\u8f03\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table border=\"1\" style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr style=\"height: 48px;\">\n<th style=\"width: 16.6667%; height: 48px; border-color: #000000;\">\u30c7\u30fc\u30bf\u578b<\/th>\n<th style=\"width: 16.6667%; height: 48px; border-color: #000000;\">\u5024\u306e\u7a2e\u985e<\/th>\n<th style=\"width: 16.6667%; height: 48px; border-color: #000000;\">\u30d3\u30c3\u30c8\u6570<\/th>\n<th style=\"width: 16.6667%; height: 48px; border-color: #000000;\">\u8868\u73fe\u3067\u304d\u308b\u5024\u306e\u7bc4\u56f2<\/th>\n<th style=\"width: 16.6667%; height: 48px; border-color: #000000;\">\u63a5\u5c3e\u8a9e<\/th>\n<th style=\"width: 16.6667%; height: 48px; border-color: #000000;\">\u5099\u8003<\/th>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">boolean<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u771f\u507d\u5024<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">1\u30d3\u30c3\u30c8<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">true\/false\u306e\u3069\u3061\u3089\u304b<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">&#8211;<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\"><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">byte<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u6574\u6570<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">8\u30d3\u30c3\u30c8(1\u30d0\u30a4\u30c8)<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">-128\uff5e<span>127<\/span><\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">&#8211;<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\"><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">short<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u6574\u6570<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">16\u30d3\u30c3\u30c8(2\u30d0\u30a4\u30c8)<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">-32,768\uff5e<span>32,767<\/span><\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">&#8211;<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\"><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">char<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u6587\u5b57<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">16\u30d3\u30c3\u30c8(2\u30d0\u30a4\u30c8)<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">0\uff5e<span>65,535<\/span><\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">&#8211;<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">Unicode\u6587\u5b57\u3001<span>\\u0000<\/span>\uff5e<span>\\uffff<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">int<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u6574\u6570<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">32\u30d3\u30c3\u30c8(4\u30d0\u30a4\u30c8)<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">-2,147,483,648\uff5e<br \/>\n2,147,483,647<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">&#8211;<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u7d04<span>\u00b121<\/span>\u5104<span>4<\/span>\u5343<span>7<\/span>\u767e\u4e07\u3001<span>Unicode<\/span>\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">long<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u6574\u6570<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">64\u30d3\u30c3\u30c8(8\u30d0\u30a4\u30c8)<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">-9,223,372,036,854,775,808\uff5e<br \/>\n<span>9,223,372,036,854,775,807<\/span><\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">L\u307e\u305f\u306f<span>l<\/span><\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u7d04<span>\u00b1922<\/span>\u4eac<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">float<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u6d6e\u52d5\u5c0f\u6570\u70b9<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">32\u30d3\u30c3\u30c8(4\u30d0\u30a4\u30c8)<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u00b13.40282347E+38\uff5e<span> 1.40239846E-45<\/span><\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">F\u307e\u305f\u306f<span>f<\/span><\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u5358\u7cbe\u5ea6<br \/>\n\u7d04<span>\u00b13.4\u00d710<\/span>\u306e<span>38<\/span>\u4e57\uff5e\u7d04<span>\u00b11.4\u00d710<\/span>\u306e<span>-45<\/span>\u4e57<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">double<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u6d6e\u52d5\u5c0f\u6570\u70b9<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">64\u30d3\u30c3\u30c8(8\u30d0\u30a4\u30c8)<\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\u00b11.79769313486231570E+308\uff5e<span>\u00b14.94065645841246544E-324<\/span><\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">D\u307e\u305f\u306f<span>d<\/span><\/td>\n<td style=\"width: 16.6667%; height: 24px; border-color: #000000;\">\n<p>\u500d\u7cbe\u5ea6<br \/>\n\u7d04<span>\u00b11.8\u00d710<\/span>\u306e<span>308<\/span>\u4e57\uff5e\u7d04<span>\u00b14.9\u00d710<\/span>\u306e<span>-324<\/span>\u4e57<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span id=\"i\">\uff11-\uff11\uff0e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306f\u6587\u5b57\u3082\u6570\u5b57\u3067\u8868\u73fe\u3059\u308b<\/span><\/h3>\n<p>Java\u306b\u9650\u3089\u305a\u30d7\u30ed\u30b0\u30e9\u30e0\u3084\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306f\u3001\u5185\u90e8\u3067\u306f\u3059\u3079\u3066\u3092\u6570\u5b57\u3067\u8868\u73fe\u3057\u307e\u3059\u3002\u6587\u5b57\u3084\u6587\u5b57\u5217\u3082\u3059\u3079\u3066\u6570\u5b57\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001<span>&#8216;A&#8217;<\/span>\u3068\u3044\u3046\u6587\u5b57\u306b\u306f\u3001<span>Unicode<\/span>\u3067\u306f<span>65<\/span>\u3068\u3044\u3046\u6570\u5b57\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u307e\u3059\u3002<span>&#8216;<\/span>\u3042<span>&#8216;<\/span>\u306f<span>12354<\/span>\u3067\u3059\u3002<\/p>\n<p>\u6587\u5b57\u3068\u6570\u5b57\u306e\u7d10\u4ed8\u3051\u65b9\u306b\u306f\u3001\u305f\u304f\u3055\u3093\u306e\u30eb\u30fc\u30eb\u304c\u3042\u308a\u307e\u3059\u3002<span>Java<\/span>\u3067\u306f\u305d\u306e\u4e00\u3064\u3067\u3042\u308b<span>Unicode<\/span>\u304c\u6700\u521d\u304b\u3089\u63a1\u7528\u3055\u308c\u3066\u3044\u3066\u3001\u305d\u306e\u4e2d\u306e<span>UTF-16<\/span>\u3068\u3044\u3046\u30eb\u30fc\u30eb\u304c\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e<span>UTF-16<\/span>\u306e<span>&#8220;16&#8221;<\/span>\u306f\u3001<span>16<\/span>\u30d3\u30c3\u30c8\u304c\u51e6\u7406\u5358\u4f4d\u3060\u3088\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3060\u304b\u3089<span>char<\/span>\u306f<span>16<\/span>\u30d3\u30c3\u30c8\u306a\u306e\u3067\u3059\u3002<\/p>\n<p>\u540c\u3058\u3088\u3046\u306a\u30eb\u30fc\u30eb\u306b\u306f\u3001\u65e5\u672c\u8a9e\u74b0\u5883\u3067\u306f\u3044\u308f\u3086\u308b\u30b7\u30d5\u30c8<span>JIS<\/span>\u3084<span>EUC-JP<\/span>\u3001<span>JIS<\/span>\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002<span>Unicode<\/span>\u306e\u4e2d\u3067\u3082\u3001<span>UTF-8<\/span>\u3084<span>UTF-32<\/span>\u3068\u3044\u3046\u3082\u306e\u3082\u3042\u308a\u307e\u3059\u3002<span>Java<\/span>\u3067\u3082\u3053\u308c\u3089\u306e\u30eb\u30fc\u30eb\u306f\u3082\u3061\u308d\u3093\u6271\u3048\u307e\u3059\u304c\u3001<span>Java<\/span>\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u4e2d\u3067\u6587\u5b57\u30fb\u6587\u5b57\u5217\u3092\u6271\u3046\u6642\u306f\u3001<span>Unicode<\/span>\u304a\u3088\u3073<span>UTF-16<\/span>\u3092\u524d\u63d0\u306b\u3059\u308b\u306e\u304c\u666e\u901a\u3067\u3059\u3002<\/p>\n<h3><span id=\"-charString\">\uff11-\uff12\uff0echar\u3068<span>String<\/span>\u306f\u9060\u304f\u3066\u8fd1\u3044\u30e2\u30ce<\/span><\/h3>\n<p>char\u3068\u3001<span>Java<\/span>\u3067\u6587\u5b57\u5217\u3092\u8868\u3059\u30af\u30e9\u30b9\u306e<span>String<\/span>\u306f\u3001\u304a\u4e92\u3044\u306b\u9055\u3063\u305f\u30e2\u30ce\u540c\u58eb\u3067\u3059\u3002<span>char<\/span>\u306f\u4e00\u6587\u5b57\u3092\u8868\u3059\u6570\u5b57\u306a\u306e\u306b\u5bfe\u3057\u3066\u3001<span>Java<\/span>\u306e<span>String<\/span>\u306f<span>0<\/span>\u6587\u5b57\u4ee5\u4e0a\u306e\u6587\u5b57\u304c\u96c6\u307e\u3063\u305f\u30e2\u30ce\u3067\u3001<span>String<\/span>\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">String s = \"ABC\"; \/\/ ABC\u3068\u3044\u3046\u6587\u5b57\u5217\u3092\u3001\r\nchar[] c = s.toCharArray(); \/\/ \u4e00\u6587\u5b57\u305a\u3064\u306e\u6587\u5b57\u306e\u914d\u5217\u306b\u5909\u63db\u3067\u304d\u308b\r\n\r\nSystem.out.println(s); \/\/ \u2192 ABC\r\nSystem.out.println(c[0]); \/\/ \u2192 1\u756a\u76ee\u306e\u6587\u5b57\u306fA\u3001\r\nSystem.out.println(c[1]); \/\/ \u2192 2\u756a\u76ee\u306e\u6587\u5b57\u306fB\u3001\r\nSystem.out.println(c[2]); \/\/ \u2192 3\u756a\u76ee\u306e\u6587\u5b57\u306fC<\/pre>\n<pre class=\"prettyprint lang:default decode:true\">char[] c = { '\u3042', '\u3044', '\u3046', '\u3048', '\u304a' }; \/\/ \u3042 \u3044 \u3046 \u3048 \u304a\u306e\u6587\u5b57\u306e\u914d\u5217\u3092\u3001\r\nString s = new String(c); \/\/ \u6587\u5b57\u5217\u306b\u5909\u63db\u3059\u308c\u3070\u3001\r\nSystem.out.println(s); \/\/ \u2192 \u6587\u5b57\u5217\u306e\"\u3042\u3044\u3046\u3048\u304a\"\u306b\u306a\u308b<\/pre>\n<p>char\u3068<span>String<\/span>\u306f\u30d7\u30ed\u30b0\u30e9\u30e0\u4e0a\u3067\u9055\u3046\u30e2\u30ce\u306a\u306e\u3067\u3001\u304a\u4e92\u3044\u306b\u4ee3\u5165\u306f\u51fa\u6765\u307e\u305b\u3093\u3057\u3001\u5024\u3092\u76f4\u63a5\u6bd4\u3079\u3089\u308c\u3082\u3057\u307e\u305b\u3093\u3002\u305d\u3046\u3044\u3046\u3053\u3068\u3092\u3059\u308b\u306a\u3089\u3001<span>char<\/span>\u304b<span>String<\/span>\u306e\u3069\u3061\u3089\u304b\u306b\u5bc4\u305b\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u306e\u3084\u308a\u65b9\u306f\u5f8c\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char c = 'A'; \/\/ \u2192 OK\u3001char\u306b\u6587\u5b57\u3092\u4ee3\u5165\u3059\u308b\r\nString s = \"A\"; \/\/ \u2192 OK\u3001String\u306b\u6587\u5b57\u5217\u3092\u4ee3\u5165\u3059\u308b\r\n\r\nchar c2 = \"A\"; \/\/ \u2192 NG(\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc)\u3001char\u306b\u6587\u5b57\u5217\u3092\u4ee3\u5165\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\r\nString s2 = 'A'; \/\/ \u2192 NG(\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc)\u3001String\u306b\u6587\u5b57\u3092\u4ee3\u5165\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\r\n\r\n\/\/ char(\u6587\u5b57)\u3068String(\u6587\u5b57\u5217)\u306f\u6bd4\u8f03\u3082\u3067\u304d\u306a\u3044\r\n\/\/ \u2193\u9055\u3046\u3082\u306e\u540c\u58eb\u3092\u6bd4\u8f03\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\r\nif ('A' == \"A\") {\r\n\tSystem.out.println(\"'A' == \\\"A\\\"\u3067\u3059\");\r\n}\r\n\r\n\/\/ \u2193\u3053\u308c\u306f\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u306b\u306f\u306a\u3089\u306a\u3044\u304c\u3001\u540c\u3058\u30e2\u30ce\u3068\u306f\u5224\u65ad\u3055\u308c\u306a\u3044\r\nif (\"A\".equals('A')) {\r\n\tSystem.out.println(\"\\\"A\\\".equals('A')\u3067\u3059\");\r\n}<\/pre>\n<p>\u306a\u304a\u3001\u305c\u3072\u77e5\u3063\u3066\u304a\u3044\u3066\u3044\u305f\u3060\u304d\u305f\u3044\u306e\u306f\u3001<span>String<\/span>\u306f<span>char<\/span>\u304c\u96c6\u307e\u3063\u3066\u3067\u304d\u3066\u3044\u308b\u30e2\u30ce\u3067\u3001<span>String<\/span>\u306f\u914d\u5217\u306e\u3088\u3046\u306a\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067<span>char<\/span>\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u305d\u3093\u306a<span>String<\/span>\u306e\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3082\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n<span style=\"text-decoration:none !important; background-color:#a61e58; color:white; padding:4px 13px; font-size:12px; font-weight:bold; position:relative; top:10px; z-index:1; left:11px;\">\u95a2\u9023\u8a18\u4e8b<\/span>\n<div class=\"blog-card\"><a target=\"_blank\" href=\"https:\/\/www.bold.ne.jp\/engineer-club\/java-string\" style=\"text-decoration:none;\">\n    <div class=\"blog-card-thumbnail\"><img src='https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2018\/10\/shutterstock_568617811-600x366.jpg' alt='\u3053\u308c\u3060\u3051\u899a\u3048\u3088\u3046! \u521d\u5fc3\u8005\u5fc5\u898b\u3001Java\u306eString\u306e\u57fa\u672c\u3068\u5fdc\u7528\u3092\u3054\u7d39\u4ecb' width=160 height=98 \/><\/div>\n    <div class=\"blog-card-content\">\n        <div class=\"blog-card-title\">\u3053\u308c\u3060\u3051\u899a\u3048\u3088\u3046! \u521d\u5fc3\u8005\u5fc5\u898b\u3001Java\u306eString\u306e\u57fa\u672c\u3068\u5fdc\u7528\u3092\u3054\u7d39\u4ecb <\/div>\n        <span style=\"font-size: 12px; font-weight: normal; position:relative; color:#666;\"><i class=\"fa fa-clock-o\"><\/i>&nbsp;2025\/10\/06<\/span>\n    <\/div>\n<div class=\"clear\"><\/div>\n<\/a><\/div>\n<h2><span id=\"Javachar\">\uff12\uff0e\u3010Java\u3011char\u306e\u4f7f\u3044\u65b9<\/span><\/h2>\n<p>\u3053\u306e\u7ae0\u3067\u306f<span>char<\/span>\u306e\u4f7f\u3044\u65b9\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002<span>char<\/span>\u3092\u4f7f\u3046\u4e0a\u3067\u306f\u3001\u3069\u3046\u3057\u3066\u3082\u3044\u308f\u3086\u308b\u300c\u6587\u5b57\u30b3\u30fc\u30c9\u300d\u306e\u77e5\u8b58\u304c\u3042\u308b\u3053\u3068\u304c\u524d\u63d0\u306b\u306a\u3063\u3066\u304f\u308b\u306e\u3067\u3001\u6700\u5c0f\u9650\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u306e\u77e5\u8b58\u306b\u3064\u3044\u3066\u3082\u304a\u4f1d\u3048\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h3><span id=\"-char\">\uff12-\uff11\uff0echar\u306e\u5ba3\u8a00\u3068\u4ee3\u5165<\/span><\/h3>\n<p>char\u306f\u6574\u6570\u3092\u8868\u3059\u30c7\u30fc\u30bf\u578b\u306e\u4e00\u3064\u3067\u3059\u3002\u5909\u6570\u306e\u5ba3\u8a00\u306e\u4ed5\u65b9\u3001\u4ee3\u5165\u306e\u4ed5\u65b9\u306a\u3069\u306f\u3001\u914d\u5217\u306e\u5834\u5408\u3082\u542b\u3081\u3066<span>Java<\/span>\u306e\u4ed6\u306e\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u3068\u540c\u3058\u3084\u308a\u65b9\u3067\u884c\u3048\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">\/\/ char\u3092\u5909\u6570\u3068\u3057\u3066\u6271\u3046\u5834\u5408\u306e\u30b5\u30f3\u30d7\u30eb\r\nchar c1; \/\/ char\u578b\u306e\u5909\u6570\u306e\u5ba3\u8a00(\u30c7\u30fc\u30bf\u578b \u5909\u6570\u540d)\r\nc1 = 65; \/\/ \u5909\u6570c\u306b65(\u6587\u5b57\u306eA)\u3092\u4ee3\u5165\u3057\u305f\r\n\r\nchar c2 = 66; \/\/ \u5909\u6570\u306e\u5ba3\u8a00\u3068\u521d\u671f\u5024(66\u2192B)\u306e\u4ee3\u5165\u3092\u540c\u6642\u306b\u884c\u3046\r\n\r\nSystem.out.println(c1); \/\/ \u2192 A\r\nSystem.out.println(c2); \/\/ \u2192 B<\/pre>\n<p>char\u306e\u914d\u5217\u306f\u6587\u5b57\u306e\u96c6\u307e\u308a\u3067\u3059\u3002\u3067\u3059\u304c\u3001<span>char<\/span>\u306e\u914d\u5217\u306f<span>String<\/span>\u305d\u306e\u3082\u306e\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<span>char<\/span>\u306e\u914d\u5217\u306f\u3001<span>char<\/span>\u3092\u3072\u3068\u307e\u3068\u3081\u306b\u3057\u3066\u53d6\u308a\u6271\u3046\u305f\u3081\u306e\u3082\u306e\u3067\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u7d20\u65e9\u304f\u30a2\u30af\u30bb\u30b9\u3057\u305f\u3044\u5834\u5408\u306b\u4e00\u6642\u7684\u306b\u4f7f\u3046\u3082\u306e\u3001\u304f\u3089\u3044\u306e\u611f\u899a\u3067\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">\/\/ char\u3092\u914d\u5217\u3068\u3057\u3066\u6271\u3046\u5834\u5408\u306e\u30b5\u30f3\u30d7\u30eb\r\nchar[] charArray1; \/\/ \u914d\u5217\u578b\u306e\u5909\u6570\u3092\u5ba3\u8a00\u3057\u3066\u3001\r\ncharArray1 = new char[3]; \/\/ \u914d\u5217\u306e\u5b9f\u4f53\u3092new\u3057\u3066\u7d10\u4ed8\u3051\u3066\u3001\r\ncharArray1[0] = 65; \/\/ \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3078\u6570\u5b57\u3092\u4ee3\u5165\u3059\u308b\r\ncharArray1[1] = 66;\r\ncharArray1[2] = 67;\r\n\r\nchar[] charArray2 = {97, 98, 99}; \/\/ \u5ba3\u8a00\u3068\u521d\u671f\u5316\u3092\u540c\u6642\u306b\u884c\u3046\r\n\r\nSystem.out.println(java.util.Arrays.toString(charArray1)); \/\/ \u2192 [A, B, C]\r\nSystem.out.println(java.util.Arrays.toString(charArray2)); \/\/ \u2192 [a, b, c]<\/pre>\n<p>char\u3092\u30d5\u30a3\u30fc\u30eb\u30c9\u3084\u914d\u5217\u3067\u4f7f\u3063\u305f\u6642\u306f\u3001\u521d\u671f\u5024\u306f<span>0<\/span>\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u308c\u306f\u4ed6\u306e\u6570\u5b57\u578b\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u3068\u540c\u3058\u52d5\u304d\u3067\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">class CharTest {\r\n\tchar c; \/\/ char\u3092\u30d5\u30a3\u30fc\u30eb\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3057\u305f\u304c\u3001\u521d\u671f\u5024\u306f\u672a\u8a2d\u5b9a\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tCharTest charTest = new CharTest();\r\n\t\tSystem.out.println(charTest.c); \/\/ \u2192 0\u3001\u5909\u6570\u5ba3\u8a00\u6642\u306b\u521d\u671f\u5316\u3055\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u50240\u304c\u8a2d\u5b9a\u3055\u308c\u308b\r\n\r\n\t\tchar[] array = new char[5];\r\n\t\tSystem.out.println(array[0]); \/\/ \u2192 0\u3001new\u3057\u305f\u6642\u70b9\u3067\u914d\u5217\u5168\u4f53\u304c0\u3067\u521d\u671f\u5316\u3055\u308c\u308b\r\n\t}\r\n}<\/pre>\n<h4>\uff12-\uff11-\uff11\uff0echar\u3078\u306f<span>0<\/span>\uff5e<span>65535<\/span>\u4ee5\u5916\u306f\u4ee3\u5165\u3067\u304d\u306a\u3044<\/h4>\n<p>char\u306f<span>0<\/span>\uff5e<span>65535<\/span>\u307e\u3067\u306e\u6574\u6570\u306a\u306e\u3067\u3001\u5c0f\u6570\u70b9\u4ee5\u4e0b\u304c\u3042\u308b\u6570\u5b57\u3001\u30de\u30a4\u30ca\u30b9\u306e\u6570\u5b57\u3001<span>65536<\/span>\u4ee5\u4e0a\u306e\u6570\u5b57\u3092\u76f4\u63a5\u4ee3\u5165\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">\/\/ \u3044\u305a\u308c\u3082\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc!!\r\nchar c1 = 3.14; \/\/ \u2192 \"double\u304b\u3089char\u306b\u306f\u5909\u63db\u3067\u304d\u307e\u305b\u3093\"\r\nchar c2 = -1; \/\/ \u2192 \"int\u304b\u3089char\u306b\u306f\u5909\u63db\u3067\u304d\u307e\u305b\u3093\"\r\nchar c3 = 65536; \/\/ \u2192 \u540c\u4e0a<\/pre>\n<p>\u305f\u3060\u3057\u3001\u305d\u308c\u3089\u3092<span>char<\/span>\u306b\u30ad\u30e3\u30b9\u30c8\u3057\u305f\u306a\u3089\u8a71\u306f\u5225\u3067\u3059\u3002\u4ed5\u7d44\u307f\u7684\u306b\u306f\u3001<span>int<\/span>\u306b\u30ad\u30e3\u30b9\u30c8\u3055\u308c\u305f\u5f8c\u3001\u3042\u3089\u305f\u3081\u3066<span>char<\/span>\u306b\u30ad\u30e3\u30b9\u30c8\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">\/\/ \u3053\u308c\u3089\u306e\u6570\u5b57\u3092char\u306b\u30ad\u30e3\u30b9\u30c8\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u308b\r\nchar c1 = (char)3.14; \/\/ \u2192 3\r\nchar c2 = (char)-1; \/\/ \u2192 65535\r\nchar c3 = (char)65536; \/\/ \u2192 0<\/pre>\n<p>char\u306f\u30ad\u30e3\u30b9\u30c8\u3057\u306a\u3044\u3067\u4f7f\u3046\u306e\u304c\u666e\u901a\u306a\u306e\u3067\u3001\u30ad\u30e3\u30b9\u30c8\u306e\u4ed5\u7d44\u307f\u306e\u8a73\u7d30\u306f\u7701\u304d\u307e\u3059\u3002\u3067\u3082\u3001<span>char<\/span>\u306f\u6570\u5b57\u578b\u306a\u306e\u3067\u3001<span>int<\/span>\u3084<span>double<\/span>\u306a\u3069\u306e\u9593\u3067\u3053\u306e\u3088\u3046\u306a\u30ad\u30e3\u30b9\u30c8\u304c\u3067\u304d\u308b\u3053\u3068\u306f\u3001\u982d\u306e\u7247\u9685\u306b\u5165\u308c\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u540c\u58eb\u306e\u30ad\u30e3\u30b9\u30c8\u306e\u30ed\u30b8\u30c3\u30af\u306f\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067\u3082\u89e6\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n<span style=\"text-decoration:none !important; background-color:#a61e58; color:white; padding:4px 13px; font-size:12px; font-weight:bold; position:relative; top:10px; z-index:1; left:11px;\">\u95a2\u9023\u8a18\u4e8b<\/span>\n<div class=\"blog-card\"><a target=\"_blank\" href=\"https:\/\/www.bold.ne.jp\/engineer-club\/java-byte\" style=\"text-decoration:none;\">\n    <div class=\"blog-card-thumbnail\"><img src='https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2018\/10\/shutterstock_568617811-600x366.jpg' alt='Java\u306ebyte\u3068\u306f\uff1fbyte\u3068\u57fa\u672c\u30c7\u30fc\u30bf\u578b\u30fb\u6587\u5b57\u5217\u306e\u5909\u63db\u3092\u8a73\u7d30\u306b\uff01' width=160 height=98 \/><\/div>\n    <div class=\"blog-card-content\">\n        <div class=\"blog-card-title\">Java\u306ebyte\u3068\u306f\uff1fbyte\u3068\u57fa\u672c\u30c7\u30fc\u30bf\u578b\u30fb\u6587\u5b57\u5217\u306e\u5909\u63db\u3092\u8a73\u7d30\u306b\uff01 <\/div>\n        <span style=\"font-size: 12px; font-weight: normal; position:relative; color:#666;\"><i class=\"fa fa-clock-o\"><\/i>&nbsp;2025\/10\/06<\/span>\n    <\/div>\n<div class=\"clear\"><\/div>\n<\/a><\/div>\n<h3><span id=\"-char-2\">\uff12-\uff12\uff0echar\u306e\u30ea\u30c6\u30e9\u30eb\u8868\u73fe\u306e\u3044\u308d\u3044\u308d<\/span><\/h3>\n<h4>\uff12-\uff12-\uff11\uff0e10\u9032\u6570\u3001<span>2<\/span>\u9032\u6570\u3001<span>8<\/span>\u9032\u6570\u3001<span>16<\/span>\u9032\u6570\u3067\u306e\u8868\u73fe<\/h4>\n<p>Java\u3067\u306f\u3001\u6570\u5b57\u306f<span>10<\/span>\u9032\u6570\u4ee5\u5916\u306b\u3082\u3001<span>2<\/span>\u9032\u6570\u3001<span>8<\/span>\u9032\u6570\u3001<span>16<\/span>\u9032\u6570\u3067\u8868\u73fe\u3067\u304d\u307e\u3059\u3002<span>char<\/span>\u3067\u6271\u3048\u308b<span>0<\/span>\uff5e<span>65535<\/span>\u306e\u7bc4\u56f2\u5185\u306a\u3089\u3001\u305d\u308c\u3089\u306e\u8868\u73fe\u3067\u3082\u610f\u5473\u306f\u540c\u3058\u3067\u3059\u3002<span>16<\/span>\u9032\u6570\u306a\u3089\u3001\u5f8c\u8ff0\u3059\u308b<span>Unicode<\/span>\u306e\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3068\u898b\u305f\u76ee\u306e\u5024\u304c\u540c\u3058\u306b\u306a\u308b\u306e\u3067<span>(\u203b)<\/span>\u3001\u5206\u304b\u308a\u3084\u3059\u304f\u306a\u308b\u30b1\u30fc\u30b9\u3082\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306d\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">\/\/ \u3044\u305a\u308c\u308265(\u6587\u5b57\u306eA)\u3092\u3001\u898b\u305f\u76ee\u306e\u8868\u73fe\u3092\u5909\u3048\u3066\u66f8\u3044\u3066\u3044\u308b\u3060\u3051\r\nchar c0 = 65; \/\/ 10\u9032\u6570\r\nchar c1 = 0b0100_0001; \/\/ 2\u9032\u6570(Java 7\u4ee5\u964d\u30010b\u59cb\u307e\u308a\u3001\"_\"\u3067\u533a\u5207\u308b\u3053\u3068\u3082\u3067\u304d\u308b)\r\nchar c2 = 0101; \/\/ 8\u9032\u6570(0\u59cb\u307e\u308a)\r\nchar c3 = 0x41; \/\/ 16\u9032\u6570(0x\u59cb\u307e\u308a)\r\n\r\nSystem.out.println(c0); \/\/ \u2192 A\r\nSystem.out.println(c1); \/\/ \u2192 A\r\nSystem.out.println(c2); \/\/ \u2192 A\r\nSystem.out.println(c3); \/\/ \u2192 A<\/pre>\n<p>\u203b\u3082\u3046\u5c11\u3057\u6b63\u78ba\u306b\u304a\u4f1d\u3048\u3059\u308b\u306a\u3089\u3001<span>char<\/span>\u3092\u6570\u5b57\u306e\u30ea\u30c6\u30e9\u30eb\u3067\u8a18\u8ff0\u3059\u308b\u5834\u5408\u306f\u3001<span>UTF-16<\/span>\u3068\u3044\u3046\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3067\u306e\u6570\u5b57\u3067\u3042\u3063\u3066\u3001\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3068\u306f\u5fc5\u305a\u3057\u3082\u540c\u3058\u306b\u306a\u308a\u307e\u305b\u3093\u3002\u4f8b\u3048\u3070\u3001\u5f8c\u8ff0\u3059\u308b\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306e\u7bc4\u56f2\u306e\u6587\u5b57\u306f\u9055\u3046\u5024\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>\uff12-\uff12-\uff12\uff0e\u6587\u5b57\u306e\u6570\u5b57\u306f\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u304f\u304f\u3063\u3066\u3082\u8868\u305b\u308b<\/h4>\n<p>Java\u3067\u306f\u4e00\u3064\u306e\u6587\u5b57\u306b\u5bfe\u3059\u308b\u6570\u5b57\u3092\u3001\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3<span>(&#8216;)<\/span>\u3067\u304f\u304f\u3063\u3066\u3082\u8868\u305b\u307e\u3059\u3002\u305a\u3063\u3068\u304a\u4f1d\u3048\u3057\u3066\u3044\u308b\u3068\u304a\u308a\u3001<span>char<\/span>\u306f\u6574\u6570\u306e\u30c7\u30fc\u30bf\u578b\u3067\u3059\u304c\u3001\u6570\u5b57\u305d\u306e\u307e\u307e\u3067\u306f\u6587\u5b57\u304c\u4f55\u304b\u5206\u304b\u308a\u3065\u3089\u3044\u306e\u3067\u3001\u6587\u5b57\u305d\u306e\u3082\u306e\u3067\u306e\u8868\u73fe\u3082\u3067\u304d\u308b\u306e\u3067\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char c1 = 'A'; \/\/ \u6570\u5b57\u306765\u3068\u66f8\u304f\u4ee3\u308f\u308a\u306b\u3001'A'\u3067\u3082\u540c\u3058\u610f\u5473\u306b\u306a\u308b\r\nchar c2 = 'B'; \/\/ 66\u306e\u4ee3\u308f\u308a\u306b'B'\r\nchar c3 = '\u3042'; \/\/ 12354\u306e\u4ee3\u308f\u308a\u306b'\u3042'\r\n\r\nSystem.out.println(c1); \/\/ \u2192 A\r\nSystem.out.println(c2); \/\/ \u2192 B\r\nSystem.out.println(c3); \/\/ \u2192 \u3042<\/pre>\n<p>&#8221;\u3067\u6570\u5b57\u306e\u4ee3\u308f\u308a\u306b\u8868\u73fe\u3067\u304d\u308b\u306e\u306f\u4e00\u6587\u5b57\u3060\u3051\u3067\u3059\u3002\u8907\u6570\u306e\u6587\u5b57\u3092<span>&#8221;<\/span>\u3067\u304f\u304f\u3063\u3066\u3057\u307e\u3046\u3068\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002\u6587\u5b57\u3092<span>&#8220;&#8221;(<\/span>\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3<span>)<\/span>\u3067\u304f\u304f\u308b\u3068<span>String<\/span>\u306b\u306a\u308b\u306e\u3067\u3059\u304c\u3001<span>Java<\/span>\u3067\u306f<span>char<\/span>\u3068<span>String<\/span>\u306f\u9055\u3046\u30e2\u30ce\u306a\u306e\u3067\u76f8\u4e92\u306b\u4ee3\u5165\u306f\u3067\u304d\u305a\u3001\u3053\u3061\u3089\u3082\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char c1 = 'AB'; \/\/ \u2192 \u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc \"\u6587\u5b57\u5b9a\u6570\u304c\u7121\u52b9\u3067\u3059\"\r\nchar c2 = \"A\"; \/\/ \u2192 \u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc \"String\u304b\u3089char\u306b\u306f\u5909\u63db\u3067\u304d\u307e\u305b\u3093\"\r\nString s = 'A'; \/\/ \u2192 \u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc \"char\u304b\u3089String\u306b\u306f\u5909\u63db\u3067\u304d\u307e\u305b\u3093\"<\/pre>\n<p>&#8221;\u3067\u304f\u304f\u3089\u308c\u305f\u30e2\u30ce\u306f\u3001<span>Java<\/span>\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u4e0a\u3067\u306f\u305d\u306e\u6587\u5b57\u304c\u8868\u3059\u6570\u5b57\u3068\u3057\u3066\u6271\u308f\u308c\u307e\u3059\u3002\u3067\u3059\u306e\u3067\u3001\u4ee5\u4e0b\u306e<span>if<\/span>\u6587\u306f<span>true<\/span>\u306b\u306a\u308a\u307e\u3059\u3057\u3001<span>&#8220;-&#8220;<\/span>\u3092\u4ed8\u3051\u305f\u308a<span>-1<\/span>\u3068\u639b\u3051\u7b97\u3059\u308c\u3070\u30de\u30a4\u30ca\u30b9\u306e\u6570\u5b57\u306b\u306a\u308a\u307e\u3059\u3057\u3001<span>char<\/span>\u540c\u58eb\u3092\u8db3\u3057\u7b97\u3067\u304d\u305f\u308a\u3057\u307e\u3059\u3002\u3053\u308c\u3067\u3001\u6587\u5b57\u306f\u6570\u5b57\u306e\u5225\u8868\u73fe\u306a\u306e\u3060\u3068\u3001\u304a\u308f\u304b\u308a\u3044\u305f\u3060\u3051\u305f\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">\/\/ 'X'\u306f\u5185\u90e8\u7684\u306b\u306f\u6570\u5b57\u306a\u306e\u3067\u3001\u6570\u5b57\u3068\u6bd4\u8f03\u3067\u304d\u308b\r\nif ('A' == 65) {\r\n\tSystem.out.println(\"'A' == 65\u3067\u3059\"); \/\/ \u3053\u3061\u3089!!\r\n} else {\r\n\tSystem.out.println(\"'A' == 65\u3067\u306f\u3042\u308a\u307e\u305b\u3093\");\r\n}\r\n\r\n\/\/ 'X'\u306f\u5185\u90e8\u7684\u306b\u306f\u6570\u5b57\u306a\u306e\u3067\u3001\u8a08\u7b97\u304c\u3067\u304d\u308b\r\nint i1 = -'A';\r\nint i2 = 'a' * -1;\r\nint i3 = 'A' + 'a';\r\nSystem.out.println(i1); \/\/ \u2192 -65\r\nSystem.out.println(i2); \/\/ \u2192 -97\r\nSystem.out.println(i3); \/\/ \u2192 -162\u3001\u6587\u5b57\u5217\u306e\"Aa\"\u306b\u306f\u306a\u3089\u306a\u3044<\/pre>\n<h4>\uff12-\uff12-\uff13\uff0e\u7279\u6b8a\u306a\u6587\u5b57\u306f\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3067\u8868\u3059<\/h4>\n<p>\u3042\u308b\u7a2e\u306e\u6587\u5b57\u306f\u3001\u76f4\u63a5\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u4e0a\u306b\u66f8\u3044\u3066\u3082\u76ee\u306b\u898b\u3048\u3065\u3089\u304b\u3063\u305f\u308a\u3001\u6271\u3044\u3065\u3089\u304b\u3063\u305f\u308a\u3057\u307e\u3059\u3002\u4f8b\u3048\u3070\u30bf\u30d6\u3084\u6539\u884c\u3067\u3059\u3002\u305d\u308c\u3089\u306e\u6587\u5b57\u3092\u8868\u73fe\u3059\u308b\u306b\u306f\u3001\u300c<span>\\<\/span>\u300d\u3068\u7d44\u307f\u5408\u308f\u305b\u305f\u3001\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3068\u3044\u3046\u7279\u5225\u306a\u66f8\u304d\u65b9\u304c\u3042\u308a\u307e\u3059\u3002\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3067\u306e\u6587\u5b57\u306e\u8868\u73fe\u306f\u3001<span>String<\/span>\u306e\u4e2d\u3067\u3082\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30d0\u30c3\u30af\u30b9\u30da\u30fc\u30b9<span> \\b (\\u0008<\/span>\u3067\u3082\u540c\u3058<span>)<\/span><\/li>\n<li>\u6c34\u5e73\u30bf\u30d6<span> \\t (\\u0009<\/span>\u3067\u3082\u540c\u3058<span>)<\/span><\/li>\n<li>\u6539\u884c<span> \\n (\\u000a<\/span>\u3067\u3082\u540c\u3058<span>)<\/span><\/li>\n<li>\u6539\u30da\u30fc\u30b8<span> \\f (\\u000c<\/span>\u3067\u3082\u540c\u3058<span>)<\/span><\/li>\n<li>\u5fa9\u5e30<span> \\r (\\u000d<\/span>\u3067\u3082\u540c\u3058<span>)<\/span><\/li>\n<li>\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3<span> \\&#8221; (\\u0022<\/span>\u3067\u3082\u540c\u3058<span>)<\/span><\/li>\n<li>\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3<span> \\&#8217; (\\u0027<\/span>\u3067\u3082\u540c\u3058<span>)<\/span><\/li>\n<li><span>\\<\/span>\u6587\u5b57<span> \\\\ (\\u005c<\/span>\u3067\u3082\u540c\u3058<span>)<\/span><\/li>\n<\/ul>\n<pre class=\"prettyprint lang:default decode:true\">\/\/ \u5370\u5b57\u304c\u96e3\u3057\u3044\u6587\u5b57\u306f\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3067\u3082\u8868\u305b\u308b\r\nchar c1 = '\\b';\r\nchar c2 = '\\t';\r\nchar c3 = '\\n';\r\nchar c4 = '\\f';\r\nchar c5 = '\\r';\r\nchar c6 = '\\\"';\r\nchar c7 = '\\'';\r\nchar c8 = '\\\\';\r\n\r\n\/\/ String\u30ea\u30c6\u30e9\u30eb\u3067\u3082\u540c\u3058\u66f8\u304d\u65b9\u304c\u3067\u304d\u308b\r\nString s1 = \"\\b\";\r\nString s2 = \"\\t\";\r\nString s3 = \"\\n\";\r\nString s4 = \"\\f\";\r\nString s5 = \"\\r\";\r\nString s6 = \"\\\"\";\r\nString s7 = \"\\'\";\r\nString s8 = \"\\\\\";<\/pre>\n<h4>\uff12-\uff12-\uff14\uff0eUnicode\u306e\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3067\u306e\u6587\u5b57\u6307\u5b9a<\/h4>\n<p>Unicode\u306e\u6587\u5b57\u306b\u306f\u3001\u4e00\u3064\u4e00\u3064\u306b\u6570\u5b57\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u6570\u5b57\u3092\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8<span>(codepoint)<\/span>\u3068\u547c\u3073\u307e\u3059\u304c\u3001<span>char<\/span>\u3092\u4f7f\u3046\u4e0a\u3067\u3082\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u304c\u4f7f\u3048\u307e\u3059\u3002\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3067\u6587\u5b57\u3092\u8868\u3059\u5834\u5408\u306f\u3001<span>Java<\/span>\u3067\u306f\u300c<span>\\u + <\/span>\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u300d\u3092\u4f7f\u3044\u3001\u3053\u308c\u306f<span>Unicode<\/span>\u30a8\u30b9\u30b1\u30fc\u30d7\u3068\u3082\u547c\u3070\u308c\u307e\u3059\u3002<\/p>\n<blockquote>\n<p>\u3010\u53c2\u8003\u3011List of Unicode characters<\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/List_of_Unicode_characters\">https:\/\/en.wikipedia.org\/wiki\/List_of_Unicode_characters<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u3010\u53c2\u8003\u3011Code Charts<\/p>\n<p><a href=\"http:\/\/unicode.org\/charts\/\">http:\/\/unicode.org\/charts\/<\/a><\/p>\n<\/blockquote>\n<p>\u4f8b\u3048\u3070\u3001<span>&#8216;<\/span>\u3042<span>&#8216;<\/span>\u306e<span>Unicode<\/span>\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u306f\u300c<span>U+3042<\/span>\u300d\u306a\u306e\u3067\u3001<span>Unicode<\/span>\u30a8\u30b9\u30b1\u30fc\u30d7\u3067\u306f\u300c<span>\\u3042<\/span>\u300d\u3067\u3059\u3002\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u4f7f\u3048\u3070\u3001\u65e5\u672c\u8a9e\u74b0\u5883\u3067\u306f\u5165\u529b\u304c\u96e3\u3057\u3044\u6587\u5b57\u3082\u30ea\u30c6\u30e9\u30eb\u3067\u8868\u73fe\u3067\u304d\u307e\u3059\u3002\u305d\u3057\u3066\u3001\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3067\u306e\u6587\u5b57\u306e\u8868\u73fe\u306f\u3001<span>String<\/span>\u306e\u4e2d\u3067\u3082\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char c1 = '\\u3042'; \/\/ \u2192 '\u3042'\r\nchar c2 = '\\u00C6'; \/\/ \u2192 '\u00c6'(A\u3068E\u304c\u5408\u308f\u3055\u3063\u305f\u6587\u5b57)\r\n\r\nSystem.out.println('\u3042' == '\\u3042'); \/\/ \u2192 true\r\nSystem.out.println(0x3042 == '\\u3042'); \/\/ \u2192 true\r\n\r\nSystem.out.println('\u00c6' == '\\u00C6'); \/\/ \u2192 true\r\nSystem.out.println(0x00C6 == '\\u00C6'); \/\/ \u2192 true\r\n\r\nString s = \"\\u3042\\u00C6\"; \/\/ \u2192 \"\u3042\u00c6\"\u3001String\u30ea\u30c6\u30e9\u30eb\u3067\u3082\u540c\u3058\u66f8\u304d\u65b9\u304c\u3067\u304d\u308b<\/pre>\n<h4>\uff12-\uff12-\uff15\uff0e\u3010\u53c2\u8003\u3011<span>2<\/span>\u3064\u306e<span>char<\/span>\u3067\u8868\u73fe\u3059\u308b\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2<\/h4>\n<p>\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3068<span>UTF-16<\/span>\u306e<span>char<\/span>\u304c\u8868\u3059\u6570\u5b57\u306f\u57fa\u672c\u7684\u306b\u306f\u540c\u3058\u3067\u3059\u3002\u305f\u3060\u3001\u3054\u304f\u521d\u671f\u306e<span>Unicode<\/span>\u306a\u3089\u3059\u3079\u3066\u306e\u6587\u5b57\u3067\u305d\u308c\u304c\u901a\u3058\u307e\u3057\u305f\u304c\u3001<span>Unicode 2.0<\/span>\u3067\u8ffd\u52a0\u3055\u308c\u305f\u300c\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2<span>(<\/span>\u4ee3\u7528\u5bfe<span>)<\/span>\u300d\u3068\u547c\u3070\u308c\u308b\u7bc4\u56f2<span>(<\/span>\u3044\u308f\u3086\u308b\u8ffd\u52a0\u9762<span>)<\/span>\u306e\u6587\u5b57\u306f\u9055\u3044\u307e\u3059\u3002<\/p>\n<p>\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306e\u7bc4\u56f2\u306b\u3042\u308b\u6587\u5b57\u306f<span>1<\/span>\u3064\u306e<span>char<\/span>\u3067\u306f\u8868\u73fe\u3067\u304d\u305a\u3001<span>2<\/span>\u3064\u306e<span>char<\/span>\u306e\u30da\u30a2<span>(<\/span>\u7d44\u307f\u5408\u308f\u305b<span>)<\/span>\u3067\u8868\u73fe\u3057\u307e\u3059\u3002<span>char<\/span>\u914d\u5217\u306e\u9577\u3055\u3082\u305d\u306e\u5206\u4f38\u3073\u307e\u3059\u3002\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3082<span>16<\/span>\u30d3\u30c3\u30c8\u306e\u7bc4\u56f2\u3092\u8d85\u3048\u305f\u3068\u3053\u308d\u306b\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u306e\u6570\u5b57\u3092<span>Java<\/span>\u4e0a\u3067\u8868\u3059\u306a\u3089<span>int<\/span>\u3092\u4f7f\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306e\u8a73\u7d30\u306f\u3053\u306e\u8a18\u4e8b\u306e\u7bc4\u56f2\u3092\u8d85\u3048\u307e\u3059\u306e\u3067\u3001\u8aac\u660e\u306f\u7701\u7565\u3057\u307e\u3059\u3002\u3067\u3082\u3001\u3044\u308f\u3086\u308b?(\u3064\u3061\u3088\u3057<span>)<\/span>\u3084?(\u307b\u3063\u3051<span>)<\/span>\u306f\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306e\u7bc4\u56f2\u306b\u3042\u308b\u6587\u5b57\u3067\u3059\u3057\u3001\u7d75\u6587\u5b57\u3082\u305d\u3046\u3067\u3059\u3002\u3053\u308c\u3089\u306e\u6587\u5b57\u306e\u7bc4\u56f2\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u6271\u3046\u5834\u5408\u306f\u3001\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306b\u3064\u3044\u3066\u5b66\u3093\u3067\u304a\u304f\u3068\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">\/\/ ?(U+20BB7)\u306f\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u3068\u547c\u3070\u308c\u308b\u7bc4\u56f2\u306b\u3042\u308b\u6587\u5b57\u3067\u30011\u3064\u306echar\u3067\u306f\u8868\u73fe\u3067\u304d\u306a\u3044\r\nchar c0 = '?'; \/\/ \u2192 \u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u3001\u3053\u306e\u6587\u5b57\u306f0\uff5e65535\u306e\u7bc4\u56f2\u5185\u3067\u306f\u306a\u3044\u305f\u3081\r\n\r\n\/\/ \u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306e\u6587\u5b57\u306f\u3001Java\u306eUnicode\u30a8\u30b9\u30b1\u30fc\u30d7\u3067\u3082\u8868\u73fe\u3067\u304d\u306a\u3044\r\nchar c1 = '\\u20BB7'; \/\/ \u2192 \u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u3001\u3053\u308c\u306f\\u20BB\u30687\u306b\u89e3\u91c8\u3055\u308c\u3066\u3057\u307e\u3046\r\nString s1 = \"\\u20BB7\"; \/\/ \u2192 \u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u3001\u7406\u7531\u306f\u540c\u4e0a\r\n\r\n\/\/ \u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306e\u6587\u5b57\u306f\u30012\u3064\u306echar\u304c\u300c\u30da\u30a2\u300d\u306b\u306a\u3063\u30661\u3064\u306e\u6587\u5b57\u306b\u306a\u308b\r\nchar[] c2 = { 0xD842, 0xDFB7 }; \/\/ 1\u3064\u306e\u6587\u5b57\u3092\u8868\u3059\u306e\u306b\u9577\u30552\u306echar\u914d\u5217\u304c\u5fc5\u8981\r\nString s2 = \"\\uD842\\uDFB7\";\r\nSystem.out.println(c2); \/\/ \u2192 ?\r\nSystem.out.println(s2); \/\/ \u2192 ?\r\n\r\n\/\/ \u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306e\u6587\u5b57\u306e\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u306f\u300132\u30d3\u30c3\u30c8\u306eint\u3067\u8868\u73fe\u3059\u308b\r\nint i = 0x20BB7;\r\nString s3 = String.format(\"%c\", i); \/\/ \u2192 \"?\"\r\nString s4 = Character.toString(i); \/\/ \u2192 \"?\"\u3001Java 11\u3088\u308a\u4f7f\u7528\u53ef\u80fd<\/pre>\n<h3><span id=\"-char-3\">\uff12-\uff13\uff0echar\u306f==\u3067\u6bd4\u8f03\u3059\u308b<\/span><\/h3>\n<p>char\u3092\u6bd4\u8f03\u3059\u308b\u6642\u306f\u3001\u5024\u3092\u6bd4\u8f03\u3059\u308b\u6f14\u7b97\u5b50\u306e<span>==<\/span>\u3092\u4f7f\u3044\u307e\u3059\u3002<span>char<\/span>\u306f\u305d\u308c\u81ea\u4f53\u304c\u4e00\u3064\u306e\u6570\u5b57\u306a\u306e\u3067\u3001\u5358\u7d14\u306b\u6570\u5b57\u3068\u3057\u3066\u6bd4\u8f03\u3059\u308c\u3070\u540c\u3058\u6587\u5b57\u304b\u5206\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>char\u306f\u4f55\u304b\u306e\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u306e\u3067\u3001<span>==<\/span>\u3067\u5b89\u5168\u306b\u6bd4\u8f03\u3067\u304d\u308b\u306e\u3067\u3059\u3002\u3082\u3061\u308d\u3093\u3001\u5927\u5c0f\u95a2\u4fc2\u3092\u5224\u65ad\u3059\u308b<span> &gt; &gt;= &lt; &lt;=<\/span>\u306a\u3069\u3082\u3001\u4ed6\u306e\u6570\u5b57\u306b\u4f7f\u3046\u5834\u5408\u3068\u540c\u3058\u3088\u3046\u306b\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char c1 = 'A';\r\nchar c2 = 65;\r\n\r\nif (c1 == c2) {\r\n\tSystem.out.println(\"c1 == c2\u3067\u3059\"); \/\/ \u3053\u3061\u3089!!\r\n} else {\r\n\tSystem.out.println(\"c1 == c2\u3067\u306f\u3042\u308a\u307e\u305b\u3093\");\r\n}<\/pre>\n<h4>\uff12-\uff13-\uff11\uff0echar\u3068<span>String<\/span>\u306f\u3069\u3061\u3089\u304b\u306b\u5bc4\u305b\u3066\u6bd4\u8f03\u3059\u308b<\/h4>\n<p>\u7e70\u308a\u8fd4\u3057\u3067\u3059\u304c\u3001<span>char<\/span>\u3068<span>String<\/span>\u306f<span>Java<\/span>\u3067\u306f\u9055\u3046\u30e2\u30ce\u306a\u306e\u3067\u3001<span>==<\/span>\u3067\u306f\u6bd4\u8f03\u3067\u304d\u307e\u305b\u3093\u3002<span>String.equals<\/span>\u306b\u3088\u308b\u6bd4\u8f03\u3067\u3082\u3001\u3082\u3061\u308d\u3093<span>false<\/span>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char c = 'A';\r\nString s = \"A\";\r\n\r\n\/*\r\n\/\/ char\u3068String\u3067\u306f==\u306f\u3067\u304d\u306a\u3044(\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc)\r\nif (c == s) {\r\n\tSystem.out.println(\"c == s\u3067\u3059\");\r\n} else {\r\n\tSystem.out.println(\"c == s\u3067\u306f\u3042\u308a\u307e\u305b\u3093\");\r\n}\r\n*\/\r\n\r\n\/\/ char\u304cCharacter\u306b\u30aa\u30fc\u30c8\u30dc\u30af\u30b7\u30f3\u30b0\u3055\u308c\u308b\u306e\u3067\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u306f\u901a\u308b\u3057\u5b9f\u884c\u3082\u3067\u304d\u308b\u3002\r\n\/\/ \u3060\u304c\u3001String\u3068Character\u3067\u306f\u30af\u30e9\u30b9\u304c\u9055\u3046\u306e\u3067\u3001\u7b49\u3057\u3044\u3068\u306f\u307f\u306a\u3055\u308c\u306a\u3044\u3002\r\nif (s.equals(c)) {\r\n\tSystem.out.println(\"s.equals(c)\u3067\u3059\");\r\n} else {\r\n\tSystem.out.println(\"s.equals(c)\u3067\u306f\u3042\u308a\u307e\u305b\u3093\"); \/\/ \u3053\u3061\u3089!!\r\n}<\/pre>\n<p>char\u3068<span>String<\/span>\u3092\u6bd4\u8f03\u3059\u308b\u306a\u3089\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b<span>char<\/span>\u304b<span>String<\/span>\u306e\u3069\u3061\u3089\u304b\u306b\u5bc4\u305b\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002<span>char<\/span>\u3068<span>String<\/span>\u306e\u5909\u63db\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u5f8c\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char c = 'A';\r\nString s = \"A\";\r\n\r\nString strFromChar = String.valueOf(c);\r\nchar charFromStr = s.charAt(0);\r\n\r\n\/\/ String\u540c\u58eb\u306a\u3089equals\u3067\u78ba\u8a8d\u3067\u304d\u308b\r\nif (s.equals(strFromChar)) {\r\n\tSystem.out.println(\"s.equals(strFromChar)\u3067\u3059\"); \/\/ \u3053\u3061\u3089!!\r\n} else {\r\n\tSystem.out.println(\"s.equals(strFromChar)\u3067\u306f\u3042\u308a\u307e\u305b\u3093\");\r\n}\r\n\r\n\/\/ char\u540c\u58eb\u306a\u3089==\u3067\u78ba\u8a8d\u3067\u304d\u308b\r\nif (c == charFromStr) {\r\n\tSystem.out.println(\"c == charFromStr\u3067\u3059\"); \/\/ \u3053\u3061\u3089!!\r\n} else {\r\n\tSystem.out.println(\"c == charFromStr\u3067\u306f\u3042\u308a\u307e\u305b\u3093\");\r\n}<\/pre>\n<h2><span id=\"JavacharString\">\uff13\uff0e\u3010Java\u3011char\u3068<span>String<\/span>\u306e\u4f7f\u3044\u65b9\u3044\u308d\u3044\u308d<\/span><\/h2>\n<p>\u3053\u306e\u7ae0\u3067\u306f\u3001<span>Java<\/span>\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u4e0a\u3067\u3088\u304f\u898b\u304b\u3051\u308b\u3001<span>char<\/span>\u3068<span>String<\/span>\u3092\u95a2\u9023\u3055\u305b\u3066\u4f7f\u3046\u30d1\u30bf\u30fc\u30f3\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>Java\u3067\u306f<span>char<\/span>\u3092\u305d\u308c\u5358\u72ec\u3067\u4f7f\u3046\u3053\u3068\u306f\u3042\u307e\u308a\u3042\u308a\u307e\u305b\u3093\u3002<span>char<\/span>\u3092\u6700\u7d42\u7684\u306b<span>String<\/span>\u306b\u3057\u305f\u308a\u3001<span>String<\/span>\u304b\u3089<span>char<\/span>\u3092\u53d6\u308a\u51fa\u3059\u306a\u3069\u3001<span>char<\/span>\u3068<span>String<\/span>\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u4f7f\u3046\u3053\u3068\u304c\u666e\u901a\u3067\u3059\u3002<\/p>\n<h3><span id=\"-charString-2\">\uff13-\uff11\uff0echar\u3092String\u306b\u5909\u63db\u3059\u308b<\/span><\/h3>\n<p>char\u306e\u4e00\u6587\u5b57\u3092String\u306b\u5909\u63db\u3059\u308b\u306b\u306f\u3001String.valueOf(char)\u3042\u308b\u3044\u306fCharacter.toString(char)\u3092\u4f7f\u3046\u3068\u7c21\u5358\u3067\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char c = 'A';\r\nString s1 = Character.toString(c);\r\nString s2 = String.valueOf(c);\r\nSystem.out.println(s1); \/\/ \u2192 \"A\"\r\nSystem.out.println(s2); \/\/ \u2192 \"A\"<\/pre>\n<h3><span id=\"-charString-3\">\uff13-\uff12\uff0e\u8907\u6570\u306e<span>char<\/span>\u3092\u4e00\u3064\u306e<span>String<\/span>\u306b\u5909\u63db\u3059\u308b<\/span><\/h3>\n<p>char\u540c\u58eb\u3092<span>+<\/span>\u3057\u305f\u3060\u3051\u3067\u306f\u3001<span>char<\/span>\u3067\u8868\u3057\u3066\u3044\u308b\u6587\u5b57\u304c\u7e4b\u304c\u3063\u305f<span>String<\/span>\u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002<span>char<\/span>\u304c\u8868\u3059\u6570\u5b57\u3092\u8db3\u3057\u5408\u308f\u305b\u305f\u5024\u3092\u6301\u3064<span>int<\/span>\u306b\u306a\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u3084\u308a\u65b9\u306f\u3044\u308d\u3044\u308d\u3042\u3063\u3066\u3001<span>&#8220;&#8221;<\/span>\u3092\u9593\u306b\u631f\u3080\u3001<span>String.valueOf<\/span>\u3092\u3057\u3066<span>+<\/span>\u3059\u308b\u3001<span>StringBuilder<\/span>\u3092\u4f7f\u3046\u3001<span>String.format<\/span>\u3092\u4f7f\u3046<span>\u2026<\/span>\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002\u5f8c\u8ff0\u3059\u308b\u3001<span>char<\/span>\u914d\u5217\u304b\u3089<span>String<\/span>\u3092\u4f5c\u308b\u65b9\u6cd5\u3067\u3082\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char c1 = 'A';\r\nchar c2 = 'B';\r\n\r\n\/\/ String s1 = c1 + c2; \/\/ \u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc!! c1 + c2\u306fint\u306b\u306a\u308a\u3001int\u304b\u3089\u76f4\u63a5String\u306b\u306f\u3067\u304d\u306a\u3044\r\nString s2 = c1 + \"\" + c2;\r\nString s3 = String.valueOf(c1) + String.valueOf(c2); \/\/ String.valueOf\u306f\u3069\u3061\u3089\u304b\u7247\u65b9\u3067\u3082\u3044\u3044\r\nString s4 = new StringBuilder().append(c1).append(c2).toString();\r\nString s5 = String.format(\"%c%c\", c1, c2);\r\nString s6 = new String(new char[] { c1, c2 });\r\n\r\nSystem.out.println(s2); \/\/ \u2192 \"AB\"\r\nSystem.out.println(s3); \/\/ \u2192 \"AB\"\r\nSystem.out.println(s4); \/\/ \u2192 \"AB\"\r\nSystem.out.println(s5); \/\/ \u2192 \"AB\"\r\nSystem.out.println(s6); \/\/ \u2192 \"AB\"<\/pre>\n<h3><span id=\"-charString-4\">\uff13-\uff13\uff0echar\u306e\u914d\u5217\u3092<span>String<\/span>\u306b\u5909\u63db\u3059\u308b<\/span><\/h3>\n<p>char\u306e\u914d\u5217\u3092<span>String<\/span>\u306b\u5909\u63db\u3059\u308b\u306b\u306f\u3001<span>String<\/span>\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e<span>String(char[])<\/span>\u3092\u4f7f\u3046\u3068\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char[] c = {'A', 'B', 'C'};\r\nString s = new String(c);\r\nSystem.out.println(s); \/\/ \u2192 \"ABC\"<\/pre>\n<p>\u3042\u308b\u3044\u306f\u3001<span>StringBuilder<\/span>\u306b<span>char<\/span>\u306e\u914d\u5217\u3092<span>append<\/span>\u3057\u305f\u5f8c\u306b<span>toString<\/span>\u3059\u308c\u3070\u3001\u4ed6\u306e\u6587\u5b57\u30fb\u6587\u5b57\u5217\u3068\u3082\u304a\u624b\u8efd\u306b\u3064\u306a\u3052\u3089\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char[] c = {'A', 'B', 'C'};\r\nStringBuilder sb = new StringBuilder();\r\nsb.append(c);\r\nString s = sb.toString();\r\nSystem.out.println(s); \/\/ \u2192 \"ABC\"<\/pre>\n<h3><span id=\"-Stringchar\">\uff13-\uff14\uff0eString\u304b\u3089\u6307\u5b9a\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e<span>char<\/span>\u3092\u53d6\u5f97\u3059\u308b<\/span><\/h3>\n<p>String\u304b\u3089\u3001\u6307\u5b9a\u3057\u305f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u3042\u308b<span>char<\/span>\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3001<span>String.charAt<\/span>\u3092\u4f7f\u3044\u307e\u3059\u3002<span>String<\/span>\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u7bc4\u56f2\u5916\u306e\u6570\u5b57\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u30e1\u30bd\u30c3\u30c9\u547c\u3073\u51fa\u3057\u6642\u306b\u4f8b\u5916\u304c\u767a\u751f\u3059\u308b\u306e\u3067\u6c17\u3092\u4ed8\u3051\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">String s = \"ABC\"; \/\/ [0:A\u30011:B\u30012:C]\r\nchar c = s.charAt(1); \/\/ \u30a4\u30f3\u30c7\u30c3\u30af\u30b91\u306e\u5834\u6240\u306b\u3042\u308bchar\u3092\u53d6\u5f97\u3059\u308b\r\nSystem.out.println(s); \/\/ \u2192 B!!<\/pre>\n<h3><span id=\"-Stringchar-2\">\uff13-\uff15\uff0eString\u3092<span>char<\/span>\u306e\u914d\u5217\u306b\u5909\u63db\u3059\u308b<\/span><\/h3>\n<p>String\u3092<span>char<\/span>\u306e\u914d\u5217\u306b\u5909\u63db\u3059\u308b\u306a\u3089\u3001<span>String.toCharArray<\/span>\u3092\u4f7f\u3046\u306e\u304c\u304a\u624b\u8efd\u3067\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">String s = \"ABC\";\r\nchar[] c = s.toCharArray();\r\nSystem.out.println(c); \/\/ \u2192 [A, B, C]<\/pre>\n<h3><span id=\"-Stringchar-3\">\uff13-\uff16\uff0eString\u3068<span>char<\/span>\u3092\u9023\u7d50\u3059\u308b<\/span><\/h3>\n<p>String\u3068<span>char<\/span>\u306f\u3001<span>+<\/span>\u3092\u4f7f\u3048\u3070\u4e8c\u3064\u3092\u3064\u306a\u3052\u305f\u65b0\u3057\u3044<span>String<\/span>\u304c\u4f5c\u3089\u308c\u307e\u3059\u3002\u7d50\u679c\u306e\u6587\u5b57\u5217\u3067\u306f\u3001<span>char<\/span>\u304c\u6570\u5b57\u306b\u306a\u308b\u3053\u3068\u306f\u3042\u308a\u307e\u305b\u3093\u306e\u3067\u3001\u3054\u5b89\u5fc3\u3092\u3002\u3082\u3061\u308d\u3093\u3001<span>StringBuilder<\/span>\u306a\u3069\u3092\u4f7f\u3063\u3066\u3064\u306a\u3052\u3066\u3082\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char c1 = 'A';\r\nchar c2 = 'C';\r\nString s1 = \"B\";\r\nString s2 = c1 + s1 + c2;\r\nSystem.out.println(s2); \/\/ \u2192 \"ABC\"<\/pre>\n<h3><span id=\"-char210816\">\uff13-\uff17\uff0echar\u3092<span>2<\/span>\u9032\u6570\u3001<span>10<\/span>\u9032\u6570\u3001<span>8<\/span>\u9032\u6570\u3001<span>16<\/span>\u9032\u6570\u306e\u6587\u5b57\u5217\u306b\u5909\u63db\u3059\u308b<\/span><\/h3>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30c7\u30d0\u30c3\u30b0\u306a\u3069\u3067\u3001<span>char<\/span>\u3092\u6587\u5b57\u3067\u306f\u306a\u304f\u3001<span>2<\/span>\u9032\u6570\u3001<span>8<\/span>\u9032\u6570\u3001<span>10<\/span>\u9032\u6570\u3001<span>16<\/span>\u9032\u6570\u3067\u51fa\u529b\u3057\u305f\u3044\u6642\u304c\u3042\u308a\u307e\u3059\u3002\u7279\u306b\u6587\u5b57\u30b3\u30fc\u30c9\u8868\u306f<span>16<\/span>\u9032\u6570\u306e\u3053\u3068\u304c\u591a\u3044\u306e\u3067\u3001\u6587\u5b57\u305d\u306e\u3082\u306e\u3088\u308a\u3082<span>16<\/span>\u9032\u6570\u306e\u65b9\u304c\u4fbf\u5229\u306a\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3044\u305a\u308c\u306e\u30d1\u30bf\u30fc\u30f3\u3067\u3082\u3001<span>Java<\/span>\u306e\u6a19\u6e96<span>API<\/span>\u3060\u3051\u3092\u4f7f\u3046\u306a\u3089\u3001<span>String.format<\/span>\u3092\u4f7f\u3046\u3068\u7c21\u5358\u3067\u3057\u3087\u3046\u3002<span>2<\/span>\u9032\u6570\u306e\u5834\u5408\u306f\u3001<span>Integer.toBinaryString<\/span>\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3068\u697d\u306b\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">char c = 'A';\r\n\r\nString s1 = String.format(\"%16s\", Integer.toBinaryString(c)).replace(\" \", \"0\"); \/\/ 2\u9032\u6570\r\nString s2 = String.format(\"%06o\", (int) c); \/\/ 8\u9032\u6570\r\nString s3 = String.format(\"%d\", (int) c); \/\/ 10\u9032\u6570\r\nString s4 = String.format(\"%02x\", (int) c); \/\/ 16\u9032\u6570\r\n\r\nSystem.out.println(s1); \/\/ \u2192 \"0000000001000001\"\r\nSystem.out.println(s2); \/\/ \u2192 \"000101\"\r\nSystem.out.println(s3); \/\/ \u2192 \"65\"\r\nSystem.out.println((int) c); \/\/ \u2192 65\u300110\u9032\u6570\u3067print\u3059\u308b\u3060\u3051\u306a\u3089\u3001\u5358\u306bint\u3084short\u3078\u30ad\u30e3\u30b9\u30c8\u3059\u308b\u3060\u3051\u3067\u3082\u53ef\r\nSystem.out.println(s4); \/\/ \u2192 \"41\"<\/pre>\n<h2><span id=\"charCharacter\">\uff15\uff0echar\u3068<span>Character<\/span><\/span><\/h2>\n<p>Java\u3067\u306f<span>16<\/span>\u30d3\u30c3\u30c8\u306e\u6574\u6570\u3092\u8868\u73fe\u3059\u308b\u305f\u3081\u306b\u3001<span>char<\/span>\u3068<span>Character<\/span>\u304a\u3088\u3073<span>short<\/span>\u3068<span>Short<\/span>\u306e\u56db\u3064\u306e\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>char\u3068<span>short<\/span>\u306f\u6587\u5b57\u3068\u6570\u5b57\u306e\u9055\u3044\u306a\u306e\u3067\u305d\u3046\u3044\u3046\u3088\u3046\u306b\u4f7f\u3044\u5206\u3051\u308c\u3070\u3044\u3044\u3068\u3057\u3066\u3001<span>Java<\/span>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u521d\u5fc3\u8005\u306f\u3001\u306a\u305c\u540c\u3058\u6587\u5b57\u306e\u8868\u3057\u65b9\u304c<span>char<\/span>\u3068<span>Character<\/span>\u3067\u4e8c\u3064\u3042\u308b\u306e\u304b\u6df7\u4e71\u3059\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u7ae0\u3067\u306f\u305d\u306e\u7406\u7531\u3068\u3001<span>char<\/span>\u3068<span>Character<\/span>\u306e\u4f7f\u3044\u5206\u3051\u306e\u65b9\u91dd\u306a\u3069\u3092\u304a\u4f1d\u3048\u3057\u307e\u3059\u3002<\/p>\n<h3><span id=\"i-2\">\uff15-\uff11\uff0e\u4e8c\u7a2e\u985e\u306e\u8868\u73fe\u65b9\u6cd5\u306f\u6027\u80fd\u78ba\u4fdd\u306e\u305f\u3081<\/span><\/h3>\n<p>Java\u3067\u306f\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u306e<span>char<\/span>\u3068\u3001\u30af\u30e9\u30b9\u306e<span>Character<\/span>\u306f\u5225\u7269\u3067\u3059\u3002<span>C#<\/span>\u306a\u3069\u3067\u306f\u3053\u3046\u3044\u3046\u533a\u5225\u304c\u306a\u3044\u306e\u306b\u3001\u306a\u305c<span>Java<\/span>\u3067\u306f\u3042\u308b\u306e\u304b\u3002\u3053\u308c\u306f\u3001<span>Java<\/span>\u304c\u751f\u307e\u308c\u305f\u5f53\u6642\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5b9f\u884c\u901f\u5ea6\u3092\u78ba\u4fdd\u3059\u308b\u305f\u3081\u3067\u3057\u305f\u3002<\/p>\n<p>Java\u306f<span>1995<\/span>\u5e74\u306b\u767b\u5834\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067\u3059\u3002\u5f53\u6642\u306e<span>CPU<\/span>\u306e\u30af\u30ed\u30c3\u30af\u5468\u6ce2\u6570\u306f\u4eca\u3068\u306f\u6841\u304c\u9055\u3044\u3001\u4e00\u822c\u5411\u3051\u306e<span>CPU<\/span>\u3067\u3088\u3046\u3084\u304f<span>100MHz<\/span>\u3092\u8d85\u3048\u305f\u304f\u3089\u3044\u3002\u30e1\u30e2\u30ea\u306e\u91cf\u3082\u5168\u4f53\u3067\u6570<span>MB<\/span>\uff5e\u6570<span>10MB<\/span>\u3068\u975e\u5e38\u306b\u4e4f\u3057\u304b\u3063\u305f\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>char\u306f<span>16<\/span>\u30d3\u30c3\u30c8\u306e\u6570\u5b57\u305d\u306e\u3082\u306e\u306a\u306e\u3067\u3001\u697d\u306b\u901f\u304f\u6271\u3048\u307e\u3059\u3002\u3057\u304b\u3057\u3001<span>char<\/span>\u3092\u30af\u30e9\u30b9\u3068\u3059\u308b\u3068\u3001\u4e00\u3064\u306e<span>char<\/span>\u306e\u6570\u5b57\u3092\u8868\u3059\u306e\u306b<span>16<\/span>\u30d3\u30c3\u30c8\u3088\u308a\u3082\u305a\u3063\u3068\u591a\u304f\u306e\u30e1\u30e2\u30ea\u3092\u4f7f\u3044\u307e\u3059\u3002\u7c21\u5358\u306a\u8a08\u7b97\u3092\u3059\u308b\u306b\u3082\u3001\u51e6\u7406\u4e0a\u3067\u306f\u4f59\u5206\u306a\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n<h3><span id=\"-Characternull\">\uff15-\uff12\uff0e\u30af\u30e9\u30b9\u306e<span>Character<\/span>\u306a\u3089<span>null<\/span>\u3092\u8868\u73fe\u3067\u304d\u308b<\/span><\/h3>\n<p>Java\u3067<span>Character<\/span>\u3092\u4f7f\u3046\u306e\u306f\u3001\u5024\u304c\u306a\u3044\u5834\u5408<span>\u2026<\/span>\u3059\u306a\u308f\u3061<span>null<\/span>\u3092\u8868\u73fe\u3057\u305f\u3044\u6642\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001<span>SQL<\/span>\u3067\u306f\u5024\u306e\u6709\u308a\u7121\u3057\u3092<span>NULL<\/span>\u304b\u3069\u3046\u304b\u3067\u8868\u73fe\u3067\u304d\u307e\u3059\u304c\u3001\u305d\u308c\u3092<span>Java<\/span>\u306e<span>char<\/span>\u3067\u306f\u4e0a\u624b\u306b\u8868\u73fe\u3067\u304d\u307e\u305b\u3093\u3002<span>char<\/span>\u306b\u306f\u5fc5\u305a\u4f55\u304b\u306e\u5024\u304c\u3042\u308b\u304b\u3089\u3067\u3059\u3002\u306a\u304a\u3001\u3053\u3053\u3067\u306e<span>null<\/span>\u306f\u3001\u6587\u5b57\u3042\u308b\u3044\u306f\u6570\u5b57\u3068\u3057\u3066\u306e<span>0x00<\/span>\u3068\u306f\u5225\u306e\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\u305d\u3046\u3044\u3046\u6642\u306b\u53c2\u7167\u578b\u3067\u3042\u308b<span>Character<\/span>\u3092\u4f7f\u3048\u3070\u3001\u5024\u304c\u306a\u3044\u3053\u3068\u3092<span>null<\/span>\u3068\u3057\u3066\u8868\u73fe\u3067\u304d\u307e\u3059\u3002<span>Character<\/span>\u3092\u3069\u3046\u3044\u3046\u6642\u306b\u4f7f\u3046\u3079\u304d\u304b\u5206\u304b\u3089\u306a\u3044\u65b9\u306f\u3001\u305d\u306e\u5909\u6570\u3067<span>null<\/span>\u3092\u8868\u73fe\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\u3092\u4e00\u3064\u306e\u6307\u91dd\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3042\u3068<span>Character<\/span>\u3092\u4f7f\u3046\u306e\u306f\u3001<span>Character<\/span>\u304c\u6301\u3064\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3044\u305f\u3044\u6642\u3068\u3001<span>List<\/span>\u30fb<span>Map<\/span>\u30fb<span>Set<\/span>\u306a\u3069\u306e<span>Collection<\/span>\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u3044\u305f\u3044\u6642\u3067\u3059\u3002<span>Collection<\/span>\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306f\u30af\u30e9\u30b9\u304c\u5bfe\u8c61\u3067\u3059\u306e\u3067\u3001<span>Character<\/span>\u3092\u4f7f\u3044\u307e\u3059\u3002\u5f8c\u8ff0\u3059\u308b\u30aa\u30fc\u30c8\u30dc\u30af\u30b7\u30f3\u30b0\u306b\u3088\u308a\u3001\u4f7f\u3044\u5206\u3051\u3092\u3042\u307e\u308a\u610f\u8b58\u305b\u305a\u306b\u6e08\u3080\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h3><span id=\"-charCharacter\">\uff15-\uff13\uff0e\u30aa\u30fc\u30c8\u30dc\u30af\u30b7\u30f3\u30b0\u3067<span>char<\/span>\u3068<span>Character<\/span>\u3092\u81ea\u52d5\u5909\u63db\u3059\u308b<\/span><\/h3>\n<p>Java 1.5\u3067\u30aa\u30fc\u30c8\u30dc\u30af\u30b7\u30f3\u30b0<span>(auto boxing)<\/span>\u3068\u3044\u3046\u4ed5\u7d44\u307f\u304c\u5c0e\u5165\u3055\u308c\u307e\u3057\u305f\u3002\u30aa\u30fc\u30c8\u30dc\u30af\u30b7\u30f3\u30b0\u3067\u3001<span>char<\/span>\u3068<span>Character<\/span>\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u4e0a\u3067\u307b\u307c\u540c\u3058\u3082\u306e\u3068\u3057\u3066\u6271\u3048\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u4e0a\u3067<span>char<\/span>\u3092\u4f7f\u3046\u6240\u3067\u306f<span>Character<\/span>\u3092\u4f7f\u3048\u307e\u3059\u3057\u3001<span>Character<\/span>\u3092\u4f7f\u3046\u6240\u3067\u306f<span>char<\/span>\u304c\u4f7f\u3048\u307e\u3059\u3002\u672c\u5f53\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u4e0a\u306f\u76f8\u5909\u308f\u3089\u305a<span>char<\/span>\u3068<span>Character<\/span>\u306f\u5225\u7269\u306a\u306e\u3067\u3059\u304c\u3001\u305d\u306e\u9055\u3044\u3092<span>Java<\/span>\u304c\u88cf\u3067\u81ea\u52d5\u7684\u306b\u5909\u63db\u3092\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">Character charObj = Character.valueOf(\"12345\"); \/\/ Character\r\nchar charPri = 65535; \/\/ char\r\n\r\ncharPri = charObj; \/\/ \u2192 12345\u3001char\u306bCharacter\u3092\u4ee3\u5165\u3067\u304d\u308b\r\ncharPri = new Character(\"65535\"); \/\/ \u2192 65535\u3001\u540c\u4e0a\r\ncharObj = 12345; \/\/ \u2192 12345\u3001Character\u306bchar\u3092\u4ee3\u5165\u3067\u304d\u308b<\/pre>\n<p>\u3053\u308c\u3067<span>Java<\/span>\u306e\u9762\u5012\u306a\u90e8\u5206\u304c\u3042\u308b\u7a0b\u5ea6\u89e3\u6d88\u3055\u308c\u307e\u3057\u305f\u3002\u3067\u3059\u304c\u3001\u524d\u8ff0\u306e\u3068\u304a\u308a<span>Character<\/span>\u306f<span>null<\/span>\u3092\u8868\u305b\u307e\u3059\u304c\u3001<span>char<\/span>\u306f\u5fc5\u305a\u4f55\u304b\u306e\u6574\u6570\u306a\u306e\u3067\u3001<span>null<\/span>\u306b\u76f8\u5f53\u3059\u308b\u3082\u306e\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u3067\u3059\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4e88\u671f\u305b\u306c\u3068\u3053\u308d\u3067<span>NullPointerException<\/span>\u304c\u767a\u751f\u3057\u305f\u308a\u3057\u307e\u3059\u3002\u3053\u308c\u306f<span>2019<\/span>\u5e74\u306e<span>Java 11<\/span>\u306e\u6642\u70b9\u3067\u3082\u5909\u308f\u3063\u3066\u3044\u307e\u305b\u3093\u3002\u30d7\u30ed\u30b0\u30e9\u30de\u304c\u6ce8\u610f\u3059\u308b\u304b\u3001<span>Optional<\/span>\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">class IntTest {\r\n\tstatic Character returnCharacter() {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tchar i = returnCharacter(); \/\/ \u2192 null\u3092char\u306b\u5909\u63db\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u5b9f\u884c\u3059\u308b\u3068NullPointerException\u304c\u767a\u751f\u3059\u308b!!\r\n\t}\r\n}<\/pre>\n<h2><span id=\"i-3\">\uff15\uff0e\u307e\u3068\u3081<\/span><\/h2>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001<span>Java<\/span>\u306e<span>char<\/span>\u306b\u95a2\u3059\u308b\u60c5\u5831\u3092\u304a\u4f1d\u3048\u3057\u3066\u304d\u307e\u3057\u305f\u3002<span>char<\/span>\u306f<span>16<\/span>\u30d3\u30c3\u30c8\u306e\u6574\u6570\u3067\u3001<span>0<\/span>\uff5e<span>65535<\/span>\u306e\u7bc4\u56f2\u3067<span>Unicode<\/span>\u30fb<span>UTF-16<\/span>\u3067\u306e\u4e00\u6587\u5b57\u3092\u8868\u3057\u307e\u3059\u3002<span>char<\/span>\u306e\u8868\u3057\u65b9\u306f\u3044\u308d\u3044\u308d\u3042\u308a\u307e\u3059\u304c\u3001\u7d50\u5c40\u306e\u3068\u3053\u308d\u3001\u4e00\u3064\u306e\u6570\u5b57\u304c\u3044\u308d\u3044\u308d\u306a\u898b\u305f\u76ee\u3092\u3057\u3066\u3044\u308b\u306b\u3059\u304e\u307e\u305b\u3093\u3002<\/p>\n<p>Java\u3067\u306f<span>char<\/span>\u3068<span>String<\/span>\u306f\u9055\u3046\u3082\u306e\u306a\u306e\u3067\u3001\u6bd4\u8f03\u3057\u305f\u308a\u3059\u308b\u5834\u5408\u306f\u3069\u3061\u3089\u304b\u306b\u5909\u63db\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002<span>char<\/span>\u304b\u3089<span>String<\/span>\u3092\u4f5c\u3063\u305f\u308a\u3001<span>String<\/span>\u304b\u3089<span>char<\/span>\u3092\u53d6\u308a\u51fa\u3057\u305f\u308a\u3059\u308b\u65b9\u6cd5\u306a\u3069\u3082\u3001\u666e\u901a\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u308b\u4e0a\u3067\u5fc5\u8981\u3068\u601d\u308f\u308c\u308b\u3082\u306e\u3092\u304a\u4f1d\u3048\u3057\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u304a\u3001\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001<span>Unicode<\/span>\u306e\u3082\u3046\u5c11\u3057\u6df1\u3044\u77e5\u8b58\u3001\u4f8b\u3048\u3070\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306e\u8a73\u7d30\u3001\u7d50\u5408\u6587\u5b57\u3001\u6b63\u898f\u5316\u3001\u53cc\u65b9\u5411\u30c6\u30ad\u30b9\u30c8\u3001\u5305\u6442\u3001\u7570\u4f53\u5b57\u30bb\u30ec\u30af\u30bf\u306a\u3069\u306b\u306f\u89e6\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u3002<span>Java<\/span>\u306b\u9650\u3089\u305a<span>Unicode<\/span>\u3092\u672c\u683c\u7684\u306b\u6271\u3046\u306b\u306f\u3001\u305d\u308c\u3089\u306e\u77e5\u8b58\u3082\u5fc5\u8981\u3068\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>Java\u306e<span>char<\/span>\u3068<span>String<\/span>\u3068<span>Unicode<\/span>\u306f\u4e00\u5fc3\u540c\u4f53\u306a\u306e\u3067\u3001\u3053\u306e\u8a18\u4e8b\u3092\u8db3\u639b\u304b\u308a\u306b\u3001<span>Java<\/span>\u3067\u6587\u5b57\u3092\u6271\u3046\u305f\u3081\u306b\u5fc5\u8981\u306a\u77e5\u8b58\u3092\u8eab\u306b\u7740\u3051\u3066\u3044\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java\u306echar\u306f16\u30d3\u30c3\u30c8(2\u30d0\u30a4\u30c8)\u306e\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u3067\u3001Unicode\u3068\u3044\u3046\u6587\u5b57\u30b3\u30fc\u30c9\u898f\u683c\u3067\u306e\u4e00\u6587\u5b57\u3092\u30010\uff5e65,535\u306e\u7bc4\u56f2\u306e\u6570\u5b57\u3067\u8868\u3057\u305f\u3082\u306e\u3067\u3059\u3002 \u30d7\u30ed\u30b0\u30e9\u30e0\u3084\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u3067\u306f\u3001\u6587\u5b57\u3082\u6570\u5b57\u3067\u8868\u3057\u307e\u3059\u306e\u3067\u3001cha [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":804,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/1517"}],"collection":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/comments?post=1517"}],"version-history":[{"count":8,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/1517\/revisions"}],"predecessor-version":[{"id":5791,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/1517\/revisions\/5791"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/media\/804"}],"wp:attachment":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/media?parent=1517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/categories?post=1517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}