{"id":1918,"date":"2018-04-30T14:33:42","date_gmt":"2018-04-30T05:33:42","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=1918"},"modified":"2023-04-16T08:37:25","modified_gmt":"2023-04-15T23:37:25","slug":"%e3%80%90java%e3%80%91%e3%82%aa%e3%83%96%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e6%8c%87%e5%90%91%ef%bc%9a%e5%a4%89%e6%95%b0%e3%81%ae%e5%88%9d%e6%9c%9f%e5%8c%96%ef%bc%88%e3%82%b3%e3%83%b3%e3%82%b9","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=1918","title":{"rendered":"\u3010Java\u3011\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\uff1a\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570\u306e\u521d\u671f\u5316\uff08\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\uff09\u3001this\u30ad\u30fc\u30ef\u30fc\u30c9"},"content":{"rendered":"<p>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570\u3092\u521d\u671f\u5316\u3059\u308b\u5834\u5408\u306f\u3001\u300c\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u300d\u3092\u4f7f\u3046\u306e\u304c\u4e00\u822c\u7684\u3067\u3059\u3002<\/p>\n<p>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u52d5\u4f5c\u30bf\u30a4\u30df\u30f3\u30b0\u3068\u3057\u3066\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u751f\u6210\u3055\u308c\u308b\u306e\u3068\u540c\u30bf\u30a4\u30df\u30f3\u30b0\u300d<\/strong><\/span>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u69cb\u6587<\/h2>\n<pre class=\"lang:default decode:true\">public class \u30af\u30e9\u30b9\u540d(){\r\n \u30af\u30e9\u30b9\u540d(){\r\n  \u2605\u3053\u3053\u306b\u3001\u521d\u671f\u5316\u3057\u305f\u3044\u5024\u3092\u8a18\u8ff0\u3057\u3066\u3044\u304f\u3002\r\n }\r\n}<\/pre>\n<p>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u69cb\u6587\u3092\u898b\u308c\u3070\u308f\u304b\u308a\u307e\u3059\u304c\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u5f15\u6570\u300d\u3084\u300c\u623b\u308a\u5024\u300d\u306f\u5b9a\u7fa9\u3057\u306a\u3044<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<h2>\u5b9f\u88c5\u4f8b<\/h2>\n<h3>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u4f7f\u3046\u524d\u306e\u30d7\u30ed\u30b0\u30e9\u30e0<\/h3>\n<pre class=\"lang:default decode:true\">public class People {\r\n\r\n\tString name = \"\u592a\u90ce\"; \/\/\u540d\u524d\r\n\tint weight = 60;  \/\/\u4f53\u91cd\r\n\r\n\tvoid weightAsk() {\r\n\t\tSystem.out.println(\"\u79c1\u306e\u4f53\u91cd\u306f\" + this.weight + \"kg\u3067\u3059\u3002\");\r\n\t}\r\n\r\n}<\/pre>\n<h3>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u9069\u7528\u5f8c\u306e\u30d7\u30ed\u30b0\u30e9\u30e0<\/h3>\n<pre class=\"lang:default decode:true\">public class People {\r\n\r\n\tString name; \/\/\u540d\u524d\r\n\tint weight;  \/\/\u4f53\u91cd\r\n\r\n\t\/\/\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\r\n\tPeople(){\r\n\t\tthis.name = \"\u592a\u90ce\"; \/\/\u540d\u524d\r\n\t\tthis.weight = 60;  \/\/\u4f53\u91cd\r\n\t}\r\n\r\n\tvoid weightAsk() {\r\n\t\tSystem.out.println(\"\u79c1\u306e\u4f53\u91cd\u306f\" + this.weight + \"kg\u3067\u3059\u3002\");\r\n\t}\r\n\r\n}<\/pre>\n<p>\u305f\u3060\u3001\u4e0a\u8a18\u306e\u4f8b\u3067\u3042\u308c\u3070\u3001\u5225\u306b\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u4f7f\u3046\u30e1\u30ea\u30c3\u30c8\u306f\u306a\u3044\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u30e1\u30ea\u30c3\u30c8\u3068\u3057\u3066\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b<span style=\"color: #ff0000;\"><strong>\u5f15\u6570\u3092\u6e21\u3059\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">public class People {\r\n\r\n\tString name; \/\/\u540d\u524d\r\n\tint weight;  \/\/\u4f53\u91cd\r\n\r\n\t\/\/\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\r\n\tPeople(String name,int weight){\r\n\t\tthis.name = name; \/\/\u540d\u524d\r\n\t\tthis.weight = weight;  \/\/\u4f53\u91cd\r\n\t}\r\n\r\n\tvoid weightAsk() {\r\n\t\tSystem.out.println(\"\u79c1\u306e\u4f53\u91cd\u306f\" + this.weight + \"kg\u3067\u3059\u3002\");\r\n\t}\r\n\r\n}<\/pre>\n<p>\u4e0a\u8a18\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4e0b\u8a18\u306e\u3088\u3046\u306b\u547c\u3093\u3067\u3042\u3052\u308c\u3070\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\u6642\u306b\u3001People\u30af\u30e9\u30b9\u306e\u5024\u3092\u500b\u3005\u306e\u5024\u306b\u66f8\u304d\u63db\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">public class Main {\r\n\r\n\tpublic static void main(String args[]) {\r\n\r\n\t\tPeople taro = new People(\"\u592a\u90ce\",60);\r\n\t\ttaro.weightAsk();\r\n\r\n\t\tPeople hanako = new People(\"\u82b1\u5b50\",40);\r\n\t\thanako.weightAsk();\r\n\r\n\t}\r\n\r\n}<\/pre>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1930\" src=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2018\/04\/\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u7d50\u679c.png\" alt=\"\" width=\"162\" height=\"59\" \/><\/p>\n<h2>\u5f15\u6570\u306a\u3057\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3082\u3001\u5f15\u6570\u3042\u308a\u3068\u540c\u6642\u306b\u5ba3\u8a00\u3067\u304d\u308b\u3002<\/h2>\n<p>\u307e\u305f\u3001\u3082\u3061\u308d\u3093\u3001\u5f15\u6570\u306a\u3057\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3082\u540c\u6642\u306b\u5ba3\u8a00\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">public class People {\r\n\r\n\tString name; \/\/\u540d\u524d\r\n\tint weight;  \/\/\u4f53\u91cd\r\n\r\n\t\/\/\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf(\u5f15\u6570\u306a\u3057)\r\n\tPeople(){\r\n\t\tthis.name = \"\u30c6\u30b9\u30c8\"; \/\/\u540d\u524d\r\n\t\tthis.weight = 100;  \/\/\u4f53\u91cd\r\n\t}\r\n\r\n\t\/\/\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf(\u5f15\u6570\u3042\u308a)\r\n\tPeople(String name,int weight){\r\n\t\tthis.name = name; \/\/\u540d\u524d\r\n\t\tthis.weight = weight;  \/\/\u4f53\u91cd\r\n\t}\r\n\r\n\tvoid weightAsk() {\r\n\t\tSystem.out.println(\"\u79c1\u306e\u4f53\u91cd\u306f\" + this.weight + \"kg\u3067\u3059\u3002\");\r\n\t}\r\n\r\n}<\/pre>\n<p>\u3053\u306e\u30e1\u30ea\u30c3\u30c8\u3068\u3057\u3066\u306f\u3001\u6bce\u56denew\u3059\u308b\u969b\u306b\u3001\u5f15\u6570\u3092\u4e0e\u3048\u308b\u3068\u3001\u30c6\u30b9\u30c8\u304c\u5927\u5909\u3060\u3063\u305f\u308a\u3059\u308b\u306e\u3067\u3001\u306a\u304f\u3066\u3082\u751f\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>this\u3068\u306f\uff1f<\/h2>\n<p>\u307e\u305f\u3001\u4e0a\u8a18\u51e6\u7406\u3060\u3068\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u51e6\u7406\u304c\u4e00\u90e8\u91cd\u8907\u3057\u3066\u3057\u307e\u3063\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u5834\u5408\u306f<span style=\"color: #ff0000;\"><strong>\u300cthis\u300d\u3092\u4f7f\u3046\u3053\u3068\u3067\u3059\u3063\u304d\u308a\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/strong><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><strong>this\u3068\u306f\u300c\u81ea\u5206\u81ea\u8eab\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u300d<\/strong><\/span>\u306e\u3053\u3068\u3002<\/p>\n<h3>\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u5834\u5408<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u30ed\u30fc\u30ab\u30eb\u5909\u6570\u300d\u3084\u300c\u30e1\u30bd\u30c3\u30c9\u306e\u5f15\u6570\u300d\u3068\u540d\u524d\u304c\u304b\u3076\u3063\u3066\u3044\u305f\u3068\u3057\u3066\u3082\u3001\u300c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5909\u6570\u300d<\/strong><\/span>\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u3001\u300c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5909\u6570\u300d\u3092\u4f7f\u3046\u5834\u5408\u306f\u3001\u660e\u793a\u7684\u306b\u300cthis\u300d\u3092\u3064\u3051\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\uff01<\/p>\n<pre class=\"lang:default decode:true\">package opp;\r\n\r\npublic class People {\r\n\r\n\tString name; \/\/\u540d\u524d\r\n\tint weight = 60;  \/\/\u4f53\u91cd\r\n\r\n\tvoid weightAsk() {\r\n\t\tint weight = 50; \/\/\u30ed\u30fc\u30ab\u30eb\u5909\u6570\r\n\t\tSystem.out.println(\"\u79c1\u306e\u4f53\u91cd\u306f\" + this.weight + \"kg\u3067\u3059\u3002\");\r\n\t}\r\n\r\n\r\n}<\/pre>\n<h3>\u5225\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u547c\u3073\u51fa\u3059\u5834\u5408<\/h3>\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308c\u3070\u3001\u5225\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">public class People {\r\n\r\n\tString name; \/\/\u540d\u524d\r\n\tint weight;  \/\/\u4f53\u91cd\r\n\r\n\t\/\/\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf(\u5f15\u6570\u306a\u3057)\r\n\tPeople(){\r\n\t\tthis(\"\u30c6\u30b9\u30c8\",100);\r\n\t}\r\n\r\n\t\/\/\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf(\u5f15\u6570\u3042\u308a)\r\n\tPeople(String name,int weight){\r\n\t\tthis.name = name; \/\/\u540d\u524d\r\n\t\tthis.weight = weight;  \/\/\u4f53\u91cd\r\n\t}\r\n\r\n\tvoid weightAsk() {\r\n\t\tSystem.out.println(\"\u79c1\u306e\u4f53\u91cd\u306f\" + this.weight + \"kg\u3067\u3059\u3002\");\r\n\t}\r\n\r\n}<\/pre>\n<p>this\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u5f15\u6570\u306a\u3057\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u300d\u3068\u300c\u5f15\u6570\u3042\u308a\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u300d\u3067\u3001\u521d\u671f\u5316\u51e6\u7406\u304c\u91cd\u8907\u3057\u306a\u3044\u3088\u3046\u306b\u3067\u304d\u307e\u3059\u3002<\/strong><\/span><\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p><span style=\"color: #ff0000;\"><span style=\"color: #000000;\">\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u30e1\u30ea\u30c3\u30c8\u3068\u3057\u3066\u306f\u3001\u4e3b\u306b\u300c<\/span><\/span><strong><span style=\"color: #ff0000;\">\u500b\u3005\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3054\u3068\u306b\u3001\u52d5\u7684\u306b\u521d\u671f\u5316\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u70b9\u300d<\/span><\/strong>\u3067\u3059\u3002<\/p>\n<p>\u30af\u30e9\u30b9\u304b\u3089\u3001\u500b\u3005\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408\u306f\u3001\u500b\u3005\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3054\u3068\u306b\u3001\u5024\u304c\u7570\u306a\u308b\u306e\u304c\u5f53\u305f\u308a\u524d\u3067\u3059\u304b\u3089\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570\u3092\u521d\u671f\u5316\u3059\u308b\u5834\u5408\u306f\u3001\u300c\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u300d\u3092\u4f7f\u3046\u306e\u304c\u4e00\u822c\u7684\u3067\u3059\u3002 \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u52d5\u4f5c\u30bf\u30a4\u30df\u30f3\u30b0\u3068\u3057\u3066\u306f\u3001\u300c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u751f\u6210\u3055\u308c\u308b\u306e\u3068\u540c\u30bf\u30a4\u30df\u30f3\u30b0\u300d\u306b\u306a\u308a\u307e\u3059\u3002 \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u69cb\u6587 public clas [&hellip;]","protected":false},"author":1,"featured_media":2013,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,29],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1918"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1918"}],"version-history":[{"count":17,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1918\/revisions"}],"predecessor-version":[{"id":18759,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1918\/revisions\/18759"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/media\/2013"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1918"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}