{"id":1935,"date":"2018-04-30T15:21:31","date_gmt":"2018-04-30T06:21:31","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=1935"},"modified":"2018-04-30T23:50:16","modified_gmt":"2018-04-30T14:50:16","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%e9%9d%99%e7%9a%84%e3%83%a1%e3%83%b3%e3%83%90","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=1935","title":{"rendered":"\u3010Java\u3011\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\uff1a\u9759\u7684(static)\u30e1\u30f3\u30d0(\u30af\u30e9\u30b9\u5909\u6570\u3001static\u30e1\u30bd\u30c3\u30c9)"},"content":{"rendered":"<h2>\u9759\u7684\u30d5\u30a3\u30fc\u30eb\u30c9<\/h2>\n<p>Java\u3067\u306f\u3001\u30af\u30e9\u30b9\u3092new\u3057\u305f\u5834\u5408\u306f\u3001\u57fa\u672c\u7684\u306b\u5225\u3005\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3068\u306a\u308a\u3001\u5225\u3005\u306e\u5024\u3092\u6301\u3064\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u958b\u767a\u3057\u3066\u3044\u308b\u3068<span style=\"color: #ff0000;\"><strong>\u300c\u5404\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u5171\u6709\u3057\u305f\u3044\u60c5\u5831\u300d<\/strong><\/span>\u3082\u51fa\u3066\u304f\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u5834\u5408\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5148\u982d\u306b\u300c<span style=\"color: #ff0000;\"><strong>static<\/strong><\/span>\u300d\u3092\u3064\u3051\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\t\u2605static String pc;\/\/\u30d1\u30bd\u30b3\u30f3\r\n\r\n}<\/pre>\n<h3>\u9759\u7684(static)\u30d5\u30a3\u30fc\u30eb\u30c9\uff08\u30af\u30e9\u30b9\u5909\u6570\uff09\u306e\u7279\u5fb4<\/h3>\n<h4>\u30d5\u30a3\u30fc\u30eb\u30c9\u304c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3054\u3068\u3067\u306f\u306a\u304f\u3001\u30af\u30e9\u30b9\u3054\u3068\u306b\u7528\u610f\u3055\u308c\u308b\u3002<\/h4>\n<p>static\u3092\u3064\u3051\u306a\u3044\u5834\u5408\u306f\u3001\u5404\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3054\u3068\u306b\u5909\u6570\u304c\u7528\u610f\u3055\u308c\u307e\u3057\u305f\u304c\u3001static\u3092\u4ed8\u3051\u308b\u3068\u30af\u30e9\u30b9\u3054\u3068\u306b\u7528\u610f\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001<span style=\"color: #ff0000;\"><strong>\u30af\u30e9\u30b9\u3092\u300cnew\u300d\u3057\u306a\u304f\u3066\u3082\u300c\u30af\u30e9\u30b9\u540d.\u9759\u7684\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\u300d\u3067\u30a2\u30af\u30bb\u30b9\u304c\u3067\u304d\u307e\u3059\u3002<\/strong><\/span><\/p>\n<p>\u306a\u306e\u3067\u3001\u300c\u9759\u7684\u30d5\u30a3\u30fc\u30eb\u30c9\u300d\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u30af\u30e9\u30b9\u5909\u6570\u300d<\/strong><\/span>\u3068\u547c\u3070\u308c\u307e\u3059\u3002<\/p>\n<h4>public static final<\/h4>\n<p>\u306a\u306e\u3067\u3001\u30af\u30e9\u30b9\u5168\u4f53\u306e\u56fa\u5b9a\u5024\u306f\u300cpublic static final\u300d\u3068\u5ba3\u8a00\u3057\u307e\u3059\u3002\uff08final\u306f\u3001\u5909\u5316\u3057\u306a\u3044\u3068\u3044\u3046\u610f\u5473\uff09<\/p>\n<h3>static\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u521d\u671f\u5316<\/h3>\n<p>static\u30d5\u30a3\u30fc\u30eb\u30c9\u306f\u3001\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u306e\u521d\u671f\u5316\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u5909\u308f\u308a\u306b\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b<span style=\"color: #ff0000;\"><strong>\u300cstatic\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u300d<\/strong><\/span>\u3068\u3044\u3046\u3082\u306e\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">public class People {\r\n\r\n\tstatic String pc;\/\/\u30d1\u30bd\u30b3\u30f3\r\n\r\n\u3000\u3000\u3000\u3000\u3000\/\/static\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306b\u3088\u308bstatic\u521d\u671f\u5316\u5b50\u306e\u521d\u671f\u5316\r\n\tstatic {\r\n\t\tpc = \"Share-PC1\";\r\n\t}\r\n\r\n\tstatic void pcUse() {\r\n\t\tSystem.out.println(\"PC\u300c\" + pc + \"\u300d\u3092\u4f7f\u3044\u307e\u3059\u3002\");\r\n\t}\r\n\r\n}<\/pre>\n<h2>\u9759\u7684\u30e1\u30bd\u30c3\u30c9<\/h2>\n<p>\u30e1\u30bd\u30c3\u30c9\u306b\u3082\u3001\u300cstatic\u300d\u3092\u4ed8\u3051\u308b\u3053\u3068\u3067\u3001\u300c\u30af\u30e9\u30b9\u540d.\u30e1\u30bd\u30c3\u30c9\u540d();\u300d\u3067new\u305b\u305a\u306b\u305d\u306e\u307e\u307e\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u306b\u306a\u308a\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\tstatic String pc = \"Share-PC\";\/\/\u30d1\u30bd\u30b3\u30f3\r\n\r\n\tstatic void pcUse() {\r\n\t\tSystem.out.println(\"PC\u300c\" + pc + \"\u300d\u3092\u4f7f\u3044\u307e\u3059\u3002\");\r\n\t}\r\n\r\n}\r\n<\/pre>\n<p>\u307e\u305f\u3001\u4e0a\u8a18\u306e\u3088\u3046\u306b\u3001<span style=\"color: #ff0000;\"><strong>static\u30e1\u30bd\u30c3\u30c9\u306e\u4e2d\u3067\u306f\u3001static\u30d5\u30a3\u30fc\u30eb\u30c9\uff08\u30af\u30e9\u30b9\u5909\u6570\uff09\u3057\u304b\u547c\u3073\u51fa\u305b\u306a\u3044<\/strong><\/span>\u306e\u3067\u6ce8\u610f\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u9759\u7684\u30d5\u30a3\u30fc\u30eb\u30c9 Java\u3067\u306f\u3001\u30af\u30e9\u30b9\u3092new\u3057\u305f\u5834\u5408\u306f\u3001\u57fa\u672c\u7684\u306b\u5225\u3005\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3068\u306a\u308a\u3001\u5225\u3005\u306e\u5024\u3092\u6301\u3064\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002 \u305f\u3060\u3001\u958b\u767a\u3057\u3066\u3044\u308b\u3068\u300c\u5404\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u5171\u6709\u3057\u305f\u3044\u60c5\u5831\u300d\u3082\u51fa\u3066\u304f\u308b\u3068\u601d\u3044\u307e\u3059\u3002 \u305d\u306e\u5834\u5408\u306f\u3001\u4e0b\u8a18\u306e\u3088 [&hellip;]","protected":false},"author":1,"featured_media":1090,"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\/1935"}],"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=1935"}],"version-history":[{"count":12,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1935\/revisions"}],"predecessor-version":[{"id":1965,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1935\/revisions\/1965"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/media\/1090"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1935"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}