{"id":329,"date":"2023-02-25T06:23:59","date_gmt":"2023-02-24T22:23:59","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=329"},"modified":"2023-04-30T14:52:30","modified_gmt":"2023-04-30T06:52:30","slug":"execution-order-of-java-static-code-blocks-and-static-variable-definitions","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/execution-order-of-java-static-code-blocks-and-static-variable-definitions\/","title":{"rendered":"Java\u9759\u6001\u4ee3\u7801\u5757\u4e0e\u9759\u6001\u53d8\u91cf\u5b9a\u4e49\u7684\u6267\u884c\u987a\u5e8f"},"content":{"rendered":"<p>\u603b\u7ed3\uff1a\u6309\u987a\u5e8f\u6267\u884c<\/p>\n<pre><code class=\"language-java\">public class StaticTest {\n    public static String API_DEV_BASE_URL = &quot;http:\/\/192.168.10.10\/&quot;;\n    public static String API_PRO_BASE_URL = &quot;http:\/\/api.appblog.cn\/&quot;;\n    public static String API_BASE_URL = API_PRO_BASE_URL;\n    public static String LOG_REPORT_URL = API_BASE_URL + &quot;log&quot;;\n\n    static {\n        API_BASE_URL = API_DEV_BASE_URL;\n    }\n\n    public static void main(String[] args) {\n        System.out.println(LOG_REPORT_URL);\n    }\n}<\/code><\/pre>\n<p><!-- more --><\/p>\n<p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<pre><code>http:\/\/api.appblog.cn\/log<\/code><\/pre>\n<pre><code class=\"language-java\">public class StaticTest {\n    public static String API_DEV_BASE_URL = &quot;http:\/\/192.168.10.10\/&quot;;\n    public static String API_PRO_BASE_URL = &quot;http:\/\/api.appblog.cn\/&quot;;\n    public static String API_BASE_URL = API_PRO_BASE_URL;\n\n    static {\n        API_BASE_URL = API_DEV_BASE_URL;\n    }\n\n    public static String LOG_REPORT_URL = API_BASE_URL + &quot;log&quot;;\n\n    public static void main(String[] args) {\n        System.out.println(LOG_REPORT_URL);\n    }\n}<\/code><\/pre>\n<p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<pre><code>http:\/\/192.168.10.10\/log<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u603b\u7ed3\uff1a\u6309\u987a\u5e8f\u6267\u884c public class StaticTest { public static String [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-329","post","type-post","status-publish","format-standard","hentry","category-java-basic"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=329"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/329\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}