{"id":120072,"date":"2026-10-31T01:48:31","date_gmt":"2026-10-30T17:48:31","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/120072.html"},"modified":"2026-10-31T01:48:31","modified_gmt":"2026-10-30T17:48:31","slug":"%e6%b7%b1%e5%85%a5%e7%90%86%e8%a7%a3-java-%e7%b1%bb%e5%8a%a0%e8%bd%bd%e6%9c%ba%e5%88%b6%e4%b8%8e%e5%8f%8c%e4%ba%b2%e5%a7%94%e6%b4%be%e6%a8%a1%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/120072.html","title":{"rendered":"\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b"},"content":{"rendered":"<h2>\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b<\/h2>\n<p>\u5728 Java \u7684\u4e16\u754c\u91cc&#xff0c;\u6709\u4e00\u53e5\u8457\u540d\u7684\u53e3\u53f7&#xff1a;\u201c\u4e00\u6b21\u7f16\u5199&#xff0c;\u5230\u5904\u8fd0\u884c&#xff08;Write Once, Run Anywhere&#xff09;\u201d\u3002\u652f\u6491\u8fd9\u4e00\u7279\u6027\u7684\u6838\u5fc3\u57fa\u77f3\u4e4b\u4e00&#xff0c;\u5c31\u662f JVM \u7684\u7c7b\u52a0\u8f7d\u673a\u5236\u3002<\/p>\n<p>\u4e0e C\/C&#043;&#043; \u9700\u8981\u5728\u7f16\u8bd1\u65f6\u8fdb\u884c\u94fe\u63a5\u4e0d\u540c&#xff0c;Java \u5c06\u7c7b\u7684\u52a0\u8f7d\u3001\u8fde\u63a5\u548c\u521d\u59cb\u5316\u653e\u5728\u4e86\u8fd0\u884c\u671f\u3002\u8fd9\u79cd\u52a8\u6001\u52a0\u8f7d\u673a\u5236\u8d4b\u4e88\u4e86 Java \u6781\u5927\u7684\u7075\u6d3b\u6027&#xff08;\u5982\u53cd\u5c04\u3001\u70ed\u90e8\u7f72\u3001\u52a8\u6001\u4ee3\u7406\u7b49&#xff09;\u3002<\/p>\n<p>\u672c\u6587\u5c06\u8be6\u7ec6\u62c6\u89e3\u7c7b\u7684\u751f\u547d\u5468\u671f&#xff0c;\u6df1\u5165\u5256\u6790\u7c7b\u52a0\u8f7d\u7684\u4e94\u4e2a\u9636\u6bb5&#xff0c;\u5e76\u91cd\u70b9\u8bb2\u89e3\u5927\u540d\u9f0e\u9f0e\u7684\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u7c7b\u7684\u751f\u547d\u5468\u671f<\/h3>\n<p>\u4e00\u4e2a Java \u7c7b\u4ece\u88ab\u52a0\u8f7d\u5230 JVM \u5185\u5b58\u4e2d&#xff0c;\u5230\u6700\u7ec8\u88ab\u5378\u8f7d\u51fa\u5185\u5b58&#xff0c;\u5b83\u7684\u751f\u547d\u5468\u671f\u5171\u5206\u4e3a 7 \u4e2a\u9636\u6bb5&#xff1a;<\/p>\n<li>\u52a0\u8f7d&#xff08;Loading&#xff09;<\/li>\n<li>\u8fde\u63a5&#xff08;Linking&#xff09;\n<ul>\n<li>\u9a8c\u8bc1&#xff08;Verification&#xff09;<\/li>\n<li>\u51c6\u5907&#xff08;Preparation&#xff09;<\/li>\n<li>\u89e3\u6790&#xff08;Resolution&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\u521d\u59cb\u5316&#xff08;Initialization&#xff09;<\/li>\n<li>\u4f7f\u7528&#xff08;Using&#xff09;<\/li>\n<li>\u5378\u8f7d&#xff08;Unloading&#xff09;<\/li>\n<p>\u5176\u4e2d&#xff0c;\u52a0\u8f7d\u3001\u9a8c\u8bc1\u3001\u51c6\u5907\u3001\u521d\u59cb\u5316\u548c\u5378\u8f7d\u8fd9\u4e94\u4e2a\u9636\u6bb5\u7684\u987a\u5e8f\u662f\u786e\u5b9a\u7684\u3002\u800c\u89e3\u6790\u9636\u6bb5\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u53ef\u4ee5\u5728\u521d\u59cb\u5316\u9636\u6bb5\u4e4b\u540e\u518d\u5f00\u59cb&#xff0c;\u8fd9\u662f\u4e3a\u4e86\u652f\u6301 Java \u7684\u52a8\u6001\u7ed1\u5b9a&#xff08;\u665a\u671f\u7ed1\u5b9a&#xff09;\u7279\u6027\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u7c7b\u52a0\u8f7d\u7684\u8be6\u7ec6\u8fc7\u7a0b\u4e0e\u4ee3\u7801\u793a\u4f8b<\/h3>\n<h4>1. \u52a0\u8f7d&#xff08;Loading&#xff09;<\/h4>\n<p>\u5728\u8fd9\u4e2a\u9636\u6bb5&#xff0c;JVM \u9700\u8981\u5b8c\u6210\u4e09\u4ef6\u4e8b\u60c5&#xff1a;<\/p>\n<li>\u901a\u8fc7\u7c7b\u7684\u5168\u9650\u5b9a\u540d\u83b7\u53d6\u5b9a\u4e49\u6b64\u7c7b\u7684\u4e8c\u8fdb\u5236\u5b57\u8282\u6d41\u3002<\/li>\n<li>\u5c06\u8fd9\u4e2a\u5b57\u8282\u6d41\u6240\u4ee3\u8868\u7684\u9759\u6001\u5b58\u50a8\u7ed3\u6784\u8f6c\u5316\u4e3a\u65b9\u6cd5\u533a\u7684\u8fd0\u884c\u65f6\u6570\u636e\u7ed3\u6784\u3002<\/li>\n<li>\u5728\u5185\u5b58\u4e2d\u751f\u6210\u4e00\u4e2a\u4ee3\u8868\u8be5\u7c7b\u7684 java.lang.Class \u5bf9\u8c61\u3002<\/li>\n<h4>2. \u9a8c\u8bc1&#xff08;Verification&#xff09;<\/h4>\n<p>\u786e\u4fdd Class \u6587\u4ef6\u7684\u5b57\u8282\u6d41\u4e2d\u5305\u542b\u7684\u4fe1\u606f\u7b26\u5408\u5f53\u524d\u865a\u62df\u673a\u7684\u8981\u6c42&#xff0c;\u4fdd\u8bc1\u865a\u62df\u673a\u7684\u5b89\u5168&#xff08;\u5982\u68c0\u67e5\u9b54\u6570 0xCAFEBABE\u3001\u7248\u672c\u53f7\u7b49&#xff09;\u3002<\/p>\n<h4>3. \u51c6\u5907&#xff08;Preparation&#xff09;<\/h4>\n<p>\u4e3a\u7c7b\u53d8\u91cf&#xff08;\u88ab static \u4fee\u9970\u7684\u53d8\u91cf&#xff09;\u5206\u914d\u5185\u5b58\u5e76\u8bbe\u7f6e\u96f6\u503c\u3002<\/p>\n<ul>\n<li>\u6ce8\u610f&#xff1a;\u8fd9\u91cc\u4e0d\u5305\u542b\u5b9e\u4f8b\u53d8\u91cf\u3002<\/li>\n<li>\u6ce8\u610f&#xff1a;\u5982\u679c\u662f final \u4fee\u9970\u7684\u5e38\u91cf&#xff0c;JVM \u4f1a\u5728\u51c6\u5907\u9636\u6bb5\u76f4\u63a5\u5c06\u5176\u8d4b\u503c\u4e3a\u771f\u5b9e\u503c\u3002<\/li>\n<\/ul>\n<h4>4. \u89e3\u6790&#xff08;Resolution&#xff09;<\/h4>\n<p>\u5c06\u5e38\u91cf\u6c60\u5185\u7684\u7b26\u53f7\u5f15\u7528\u66ff\u6362\u4e3a\u76f4\u63a5\u5f15\u7528\u7684\u8fc7\u7a0b\u3002<\/p>\n<h4>5. \u521d\u59cb\u5316&#xff08;Initialization&#xff09;<\/h4>\n<p>\u521d\u59cb\u5316\u9636\u6bb5\u662f\u6267\u884c\u7c7b\u6784\u9020\u5668 &lt;clinit&gt;() \u65b9\u6cd5\u7684\u8fc7\u7a0b\u3002\u5728\u8fd9\u4e2a\u9636\u6bb5&#xff0c;JVM \u624d\u771f\u6b63\u5f00\u59cb\u6267\u884c\u7c7b\u4e2d\u5b9a\u4e49\u7684 Java \u7a0b\u5e8f\u4ee3\u7801&#xff08;\u5982\u9759\u6001\u53d8\u91cf\u7684\u771f\u5b9e\u8d4b\u503c\u3001\u9759\u6001\u4ee3\u7801\u5757&#xff09;\u3002<\/p>\n<h5>&#x1f50d; \u3010\u4ee3\u7801\u793a\u4f8b&#xff1a;\u51c6\u5907\u9636\u6bb5 vs \u521d\u59cb\u5316\u9636\u6bb5\u3011<\/h5>\n<p>\u4e3a\u4e86\u76f4\u89c2\u7406\u89e3\u51c6\u5907\u9636\u6bb5\u548c\u521d\u59cb\u5316\u9636\u6bb5\u7684\u533a\u522b&#xff0c;\u8bf7\u770b\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801&#xff1a;<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">ClassInitDemo<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ 1. \u51c6\u5907\u9636\u6bb5&#xff1a;\u5206\u914d\u5185\u5b58&#xff0c;\u8d4b\u96f6\u503c&#xff08;0&#xff09;<\/span><br \/>\n    <span class=\"token comment\">\/\/ 2. \u521d\u59cb\u5316\u9636\u6bb5&#xff1a;\u8d4b\u771f\u5b9e\u503c&#xff08;10&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">int<\/span> value <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">10<\/span><span class=\"token punctuation\">;<\/span> <\/p>\n<p>    <span class=\"token comment\">\/\/ 1. \u51c6\u5907\u9636\u6bb5&#xff1a;\u56e0\u4e3a\u662f final \u5e38\u91cf&#xff0c;\u76f4\u63a5\u8d4b\u771f\u5b9e\u503c&#xff08;20&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">final<\/span> <span class=\"token keyword\">int<\/span> <span class=\"token constant\">CONST_VALUE<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">20<\/span><span class=\"token punctuation\">;<\/span> <\/p>\n<p>    <span class=\"token comment\">\/\/ \u9759\u6001\u4ee3\u7801\u5757\u5728\u521d\u59cb\u5316\u9636\u6bb5\u6267\u884c<\/span><br \/>\n    <span class=\"token keyword\">static<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;ClassInitDemo \u6b63\u5728\u521d\u59cb\u5316&#8230;&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        value <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">30<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u8986\u76d6\u4e4b\u524d\u7684 10<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5728\u7c7b\u52a0\u8f7d\u7684\u51c6\u5907\u9636\u6bb5&#xff0c;value \u4f1a\u88ab\u8d4b\u503c\u4e3a 0&#xff0c;CONST_VALUE \u76f4\u63a5\u8d4b\u503c\u4e3a 20\u3002<br \/>\n\u5728\u521d\u59cb\u5316\u9636\u6bb5&#xff0c;\u6267\u884c &lt;clinit&gt;() \u65b9\u6cd5&#xff0c;value \u4f1a\u5148\u88ab\u8d4b\u503c\u4e3a 10&#xff0c;\u7136\u540e\u6267\u884c\u9759\u6001\u4ee3\u7801\u5757&#xff0c;\u6253\u5370\u63d0\u793a\u4fe1\u606f&#xff0c;\u6700\u540e value \u88ab\u6539\u4e3a 30\u3002<\/p>\n<h5>&#x1f50d; \u3010\u4ee3\u7801\u793a\u4f8b&#xff1a;\u4ec0\u4e48\u65f6\u5019\u4f1a\u89e6\u53d1\u521d\u59cb\u5316&#xff1f;\u3011<\/h5>\n<p>JVM \u4e25\u683c\u89c4\u5b9a\u4e86\u53ea\u6709\u4e3b\u52a8\u5f15\u7528\u624d\u4f1a\u89e6\u53d1\u521d\u59cb\u5316\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u88ab\u52a8\u5f15\u7528\u7684\u4f8b\u5b50\u6765\u9a8c\u8bc1\u3002<\/p>\n<p>\u573a\u666f\u4e00&#xff1a;\u901a\u8fc7\u5b50\u7c7b\u5f15\u7528\u7236\u7c7b\u7684\u9759\u6001\u5b57\u6bb5<\/p>\n<p><span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Parent<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">static<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Parent \u521d\u59cb\u5316&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">int<\/span> value <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">100<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Child<\/span> <span class=\"token keyword\">extends<\/span> <span class=\"token class-name\">Parent<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">static<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Child \u521d\u59cb\u5316&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Test<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u53ea\u8f93\u51fa &#034;Parent \u521d\u59cb\u5316&#034;&#xff0c;\u4e0d\u4f1a\u8f93\u51fa &#034;Child \u521d\u59cb\u5316&#034;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u56e0\u4e3a\u5bf9\u4e8e\u9759\u6001\u5b57\u6bb5&#xff0c;\u53ea\u6709\u76f4\u63a5\u5b9a\u4e49\u8fd9\u4e2a\u5b57\u6bb5\u7684\u7c7b\u624d\u4f1a\u88ab\u521d\u59cb\u5316<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Child<\/span><span class=\"token punctuation\">.<\/span>value<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u573a\u666f\u4e8c&#xff1a;\u901a\u8fc7\u6570\u7ec4\u5b9a\u4e49\u6765\u5f15\u7528\u7c7b<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Test<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u4e0d\u4f1a\u89e6\u53d1 Parent \u7684\u521d\u59cb\u5316&#xff0c;\u53ea\u4f1a\u751f\u6210\u4e00\u4e2a [LParent; \u7684\u6570\u7ec4\u7c7b\u578b\u5bf9\u8c61<\/span><br \/>\n        <span class=\"token class-name\">Parent<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> parents <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Parent<\/span><span class=\"token punctuation\">[<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u573a\u666f\u4e09&#xff1a;\u5f15\u7528 static final \u5e38\u91cf<\/p>\n<p><span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Constants<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">static<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Constants \u521d\u59cb\u5316&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">final<\/span> <span class=\"token class-name\">String<\/span> <span class=\"token constant\">HELLO<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;Hello World&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Test<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u4e0d\u4f1a\u89e6\u53d1 Constants \u521d\u59cb\u5316<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u56e0\u4e3a\u5728\u7f16\u8bd1\u9636\u6bb5&#xff0c;HELLO \u5df2\u7ecf\u5b58\u5165 Test \u7c7b\u7684\u5e38\u91cf\u6c60\u4e2d&#xff0c;\u5c5e\u4e8e\u7f16\u8bd1\u671f\u4f18\u5316<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Constants<\/span><span class=\"token punctuation\">.<\/span><span class=\"token constant\">HELLO<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h3>\u4e09\u3001\u7c7b\u52a0\u8f7d\u5668&#xff08;ClassLoader&#xff09;<\/h3>\n<p>\u7c7b\u52a0\u8f7d\u5668\u8d1f\u8d23\u5c06 .class \u6587\u4ef6\u52a0\u8f7d\u5230 JVM \u4e2d\u3002\u5bf9\u4e8e\u4efb\u610f\u4e00\u4e2a\u7c7b&#xff0c;\u90fd\u9700\u8981\u7531\u52a0\u8f7d\u5b83\u7684\u7c7b\u52a0\u8f7d\u5668\u548c\u8fd9\u4e2a\u7c7b\u672c\u8eab\u4e00\u540c\u786e\u7acb\u5176\u5728 JVM \u4e2d\u7684\u552f\u4e00\u6027\u3002<\/p>\n<p>JVM \u63d0\u4f9b\u4e86\u4ee5\u4e0b\u4e09\u79cd\u7cfb\u7edf\u63d0\u4f9b\u7684\u7c7b\u52a0\u8f7d\u5668&#xff1a;<\/p>\n<li>\u542f\u52a8\u7c7b\u52a0\u8f7d\u5668&#xff08;Bootstrap ClassLoader&#xff09;&#xff1a;\n<ul>\n<li>C&#043;&#043; \u5b9e\u73b0&#xff0c;\u52a0\u8f7d &lt;JAVA_HOME&gt;\\\\lib \u76ee\u5f55\u4e0b\u7684\u6838\u5fc3\u7c7b\u5e93&#xff08;\u5982 rt.jar&#xff09;\u3002<\/li>\n<li>\u65e0\u6cd5\u88ab Java \u7a0b\u5e8f\u76f4\u63a5\u5f15\u7528&#xff08;\u5728\u4ee3\u7801\u4e2d\u83b7\u53d6\u4f1a\u8fd4\u56de null&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u6269\u5c55\u7c7b\u52a0\u8f7d\u5668&#xff08;Extension ClassLoader&#xff09;&#xff1a;\n<ul>\n<li>Java \u5b9e\u73b0&#xff0c;\u52a0\u8f7d &lt;JAVA_HOME&gt;\\\\lib\\\\ext \u76ee\u5f55\u4e0b\u7684\u7c7b\u5e93\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5e94\u7528\u7a0b\u5e8f\u7c7b\u52a0\u8f7d\u5668&#xff08;Application ClassLoader&#xff09;&#xff1a;\n<ul>\n<li>Java \u5b9e\u73b0&#xff0c;\u9ed8\u8ba4\u7684\u7c7b\u52a0\u8f7d\u5668&#xff0c;\u8d1f\u8d23\u52a0\u8f7d\u7528\u6237 ClassPath \u4e0a\u7684\u7c7b\u3002<\/li>\n<\/ul>\n<\/li>\n<hr \/>\n<h3>\u56db\u3001\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b&#xff08;Parent Delegation Model&#xff09;<\/h3>\n<h4>1. \u4ec0\u4e48\u662f\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b&#xff1f;<\/h4>\n<p>\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b\u8981\u6c42\u9664\u4e86\u9876\u5c42\u7684\u542f\u52a8\u7c7b\u52a0\u8f7d\u5668\u5916&#xff0c;\u5176\u4f59\u7684\u7c7b\u52a0\u8f7d\u5668\u90fd\u5e94\u5f53\u6709\u81ea\u5df1\u7684\u7236\u7c7b\u52a0\u8f7d\u5668\u3002<\/p>\n<p>\u5de5\u4f5c\u6d41\u7a0b&#xff1a;<br \/>\n\u5f53\u4e00\u4e2a\u7c7b\u52a0\u8f7d\u5668\u6536\u5230\u7c7b\u52a0\u8f7d\u7684\u8bf7\u6c42\u65f6&#xff0c;\u5b83\u4e0d\u4f1a\u81ea\u5df1\u5148\u53bb\u5c1d\u8bd5\u52a0\u8f7d&#xff0c;\u800c\u662f\u628a\u8fd9\u4e2a\u8bf7\u6c42\u59d4\u6d3e\u7ed9\u7236\u7c7b\u52a0\u8f7d\u5668\u53bb\u5b8c\u6210\u3002\u6bcf\u4e00\u5c42\u90fd\u662f\u5982\u6b64\u3002<br \/>\n\u53ea\u6709\u5f53\u7236\u7c7b\u52a0\u8f7d\u5668\u53cd\u9988\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u8fd9\u4e2a\u52a0\u8f7d\u8bf7\u6c42\u65f6&#xff0c;\u5b50\u52a0\u8f7d\u5668\u624d\u4f1a\u5c1d\u8bd5\u81ea\u5df1\u53bb\u52a0\u8f7d\u3002<\/p>\n<p>\u6d41\u7a0b\u56fe&#xff1a;<\/p>\n<p>      \u81ea\u5b9a\u4e49\u7c7b\u52a0\u8f7d\u5668<br \/>\n           |<br \/>\n       (\u59d4\u6d3e\u8bf7\u6c42) &#8212;&gt; \u5e94\u7528\u7a0b\u5e8f\u7c7b\u52a0\u8f7d\u5668<br \/>\n                         |<br \/>\n                     (\u59d4\u6d3e\u8bf7\u6c42) &#8212;&gt; \u6269\u5c55\u7c7b\u52a0\u8f7d\u5668<br \/>\n                                       |<br \/>\n                                   (\u59d4\u6d3e\u8bf7\u6c42) &#8212;&gt; \u542f\u52a8\u7c7b\u52a0\u8f7d\u5668<br \/>\n                                                     |<br \/>\n     [\u627e\u5230] &lt;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- (\u5c1d\u8bd5\u52a0\u8f7d)<br \/>\n       |                                             |<br \/>\n     [\u52a0\u8f7d\u6210\u529f]                                   [\u627e\u4e0d\u5230]<br \/>\n                                                     |<br \/>\n     [\u5b50\u52a0\u8f7d\u5668\u5c1d\u8bd5\u52a0\u8f7d] &lt;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; (\u56de\u9000)<\/p>\n<h5>&#x1f50d; \u3010\u4ee3\u7801\u793a\u4f8b&#xff1a;\u67e5\u770b\u7c7b\u52a0\u8f7d\u5668\u7684\u59d4\u6d3e\u5c42\u7ea7\u3011<\/h5>\n<p>\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 getClassLoader() \u65b9\u6cd5\u6765\u89c2\u5bdf\u7c7b\u7684\u52a0\u8f7d\u5668\u5c42\u7ea7&#xff1a;<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">ClassLoaderDemo<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ 1. String \u7c7b\u7531\u542f\u52a8\u7c7b\u52a0\u8f7d\u5668\u52a0\u8f7d&#xff0c;Java \u4e2d\u83b7\u53d6\u4e0d\u5230&#xff0c;\u8fd4\u56de null<\/span><br \/>\n        <span class=\"token class-name\">ClassLoader<\/span> loader1 <span class=\"token operator\">&#061;<\/span> <span class=\"token class-name\">String<\/span><span class=\"token punctuation\">.<\/span><span class=\"token keyword\">class<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getClassLoader<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;String \u7684\u7c7b\u52a0\u8f7d\u5668: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> loader1<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u8f93\u51fa: null<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ 2. \u6211\u4eec\u81ea\u5df1\u5199\u7684\u7c7b&#xff0c;\u7531\u5e94\u7528\u7a0b\u5e8f\u7c7b\u52a0\u8f7d\u5668\u52a0\u8f7d<\/span><br \/>\n        <span class=\"token class-name\">ClassLoader<\/span> loader2 <span class=\"token operator\">&#061;<\/span> <span class=\"token class-name\">ClassLoaderDemo<\/span><span class=\"token punctuation\">.<\/span><span class=\"token keyword\">class<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getClassLoader<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;ClassLoaderDemo \u7684\u7c7b\u52a0\u8f7d\u5668: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> loader2<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u8f93\u51fa: sun.misc.Launcher$AppClassLoader&#064;&#8230;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ 3. \u83b7\u53d6\u5e94\u7528\u7a0b\u5e8f\u7c7b\u52a0\u8f7d\u5668\u7684\u7236\u52a0\u8f7d\u5668&#xff08;\u6269\u5c55\u7c7b\u52a0\u8f7d\u5668&#xff09;<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;AppClassLoader \u7684\u7236\u52a0\u8f7d\u5668: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> loader2<span class=\"token punctuation\">.<\/span><span class=\"token function\">getParent<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u8f93\u51fa: sun.misc.Launcher$ExtClassLoader&#064;&#8230;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ 4. \u6269\u5c55\u7c7b\u52a0\u8f7d\u5668\u7684\u7236\u52a0\u8f7d\u5668\u662f\u542f\u52a8\u7c7b\u52a0\u8f7d\u5668&#xff0c;\u83b7\u53d6\u4e0d\u5230<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;ExtClassLoader \u7684\u7236\u52a0\u8f7d\u5668: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> loader2<span class=\"token punctuation\">.<\/span><span class=\"token function\">getParent<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getParent<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u8f93\u51fa: null<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>2. \u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b\u7684\u4f18\u70b9<\/h4>\n<li>\u4fdd\u8bc1\u6838\u5fc3\u7c7b\u7684\u5b89\u5168\u6027\u3002<\/li>\n<li>\u907f\u514d\u7c7b\u7684\u91cd\u590d\u52a0\u8f7d\u3002<\/li>\n<h5>&#x1f50d; \u3010\u4ee3\u7801\u793a\u4f8b&#xff1a;\u9a8c\u8bc1\u53cc\u4eb2\u59d4\u6d3e\u7684\u5b89\u5168\u673a\u5236\u3011<\/h5>\n<p>\u5047\u8bbe\u6211\u4eec\u5728\u81ea\u5df1\u7684\u9879\u76ee\u4e2d&#xff0c;\u6076\u610f\u6216\u51fa\u4e8e\u597d\u5947&#xff0c;\u521b\u5efa\u4e86\u4e00\u4e2a\u4e0e JDK \u6838\u5fc3\u7c7b\u540c\u540d\u7684\u7c7b java.lang.String&#xff1a;<\/p>\n<p><span class=\"token keyword\">package<\/span> <span class=\"token namespace\">java<span class=\"token punctuation\">.<\/span>lang<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">String<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">static<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u6211\u662f\u9ed1\u5ba2\u81ea\u5df1\u5199\u7684 String \u7c7b&#xff01;&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u5c1d\u8bd5\u6267\u884c\u81ea\u5b9a\u4e49\u7684 String \u7c7b&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5982\u679c\u4f60\u5c1d\u8bd5\u8fd0\u884c\u8fd9\u4e2a main \u65b9\u6cd5&#xff0c;\u7a0b\u5e8f\u4f1a\u62a5\u9519&#xff08;\u6216\u8005\u6839\u672c\u52a0\u8f7d\u4e0d\u5230\u6211\u4eec\u5199\u7684\u8fd9\u4e2a\u7c7b&#xff09;\u3002<br \/>\n\u539f\u56e0\u5c31\u5728\u4e8e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b&#xff1a;\u5f53 AppClassLoader \u6536\u5230\u52a0\u8f7d java.lang.String \u7684\u8bf7\u6c42\u65f6&#xff0c;\u5b83\u4f1a\u4e00\u8def\u59d4\u6d3e\u7ed9 Bootstrap ClassLoader\u3002Bootstrap \u53d1\u73b0\u8fd9\u662f\u6838\u5fc3\u7c7b&#xff0c;\u76f4\u63a5\u52a0\u8f7d\u4e86 JDK \u771f\u6b63\u7684 String \u7c7b&#xff0c;\u6211\u4eec\u5199\u7684\u8fd9\u4e2a\u5047\u5192\u7c7b\u6839\u672c\u6ca1\u6709\u673a\u4f1a\u88ab\u52a0\u8f7d\u3002\u8fd9\u6781\u5927\u5730\u4fdd\u8bc1\u4e86 JVM \u7684\u5b89\u5168\u3002<\/p>\n<hr \/>\n<h4>3. \u5982\u4f55\u6253\u7834\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b&#xff1f;&#xff08;\u8fdb\u9636&#xff09;<\/h4>\n<p>\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b\u5e76\u4e0d\u662f\u4e00\u4e2a\u5f3a\u5236\u6027\u7684\u7ea6\u675f&#xff0c;\u5728\u4ee5\u4e0b\u573a\u666f\u4e2d&#xff0c;\u5b83\u7684\u673a\u5236\u88ab\u201c\u6253\u7834\u201d\u4e86&#xff1a;<\/p>\n<li>SPI \u673a\u5236&#xff08;\u5982 JDBC&#xff09;&#xff1a;\n<ul>\n<li>\u6838\u5fc3\u63a5\u53e3 java.sql.Driver \u7531 Bootstrap ClassLoader \u52a0\u8f7d\u3002\u4f46\u5177\u4f53\u7684\u6570\u636e\u5e93\u9a71\u52a8&#xff08;\u5982 com.mysql.cj.jdbc.Driver&#xff09;\u7531 AppClassLoader \u52a0\u8f7d\u3002<\/li>\n<li>\u4e3a\u4e86\u89e3\u51b3\u7236\u52a0\u8f7d\u5668\u65e0\u6cd5\u770b\u5230\u5b50\u52a0\u8f7d\u5668\u52a0\u8f7d\u7684\u7c7b\u7684\u95ee\u9898&#xff0c;\u5f15\u5165\u4e86\u7ebf\u7a0b\u4e0a\u4e0b\u6587\u7c7b\u52a0\u8f7d\u5668&#xff08;Thread Context ClassLoader&#xff09;&#xff0c;\u7531\u7236\u52a0\u8f7d\u5668\u201c\u9006\u5411\u59d4\u6d3e\u201d\u7ed9\u5b50\u52a0\u8f7d\u5668\u53bb\u52a0\u8f7d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>Tomcat \u7b49 Web \u5bb9\u5668&#xff1a;\n<ul>\n<li>Tomcat \u4e3a\u4e86\u5b9e\u73b0\u5e94\u7528\u9694\u79bb&#xff08;\u4e0d\u540c Web \u5e94\u7528\u4f9d\u8d56\u4e0d\u540c\u7248\u672c\u7684\u5e93&#xff09;\u548c\u70ed\u90e8\u7f72&#xff0c;\u91c7\u7528\u4e86\u7834\u574f\u53cc\u4eb2\u59d4\u6d3e\u7684\u81ea\u5b9a\u4e49\u7c7b\u52a0\u8f7d\u5668\u67b6\u6784\u3002\u5b83\u4f18\u5148\u52a0\u8f7d\u672c\u5730 Web \u5e94\u7528\u76ee\u5f55\u4e0b\u7684\u7c7b&#xff0c;\u53ea\u6709\u5728\u627e\u4e0d\u5230\u65f6\u624d\u59d4\u6d3e\u7ed9\u7236\u7c7b\u52a0\u8f7d\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<hr \/>\n<h3>\u4e94\u3001\u603b\u7ed3<\/h3>\n<table>\n<tr>\u7ef4\u5ea6\u6838\u5fc3\u8981\u70b9<\/tr>\n<tbody>\n<tr>\n<td>\u52a0\u8f7d\u8fc7\u7a0b<\/td>\n<td>\u52a0\u8f7d -&gt; \u9a8c\u8bc1 -&gt; \u51c6\u5907 -&gt; \u89e3\u6790 -&gt; \u521d\u59cb\u5316<\/td>\n<\/tr>\n<tr>\n<td>\u51c6\u5907\u9636\u6bb5<\/td>\n<td>\u4e3a static \u53d8\u91cf\u5206\u914d\u5185\u5b58\u5e76\u8d4b\u96f6\u503c&#xff08;final \u5e38\u91cf\u76f4\u63a5\u8d4b\u771f\u5b9e\u503c&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u521d\u59cb\u5316<\/td>\n<td>\u6267\u884c &lt;clinit&gt;()&#xff0c;\u5305\u62ec\u9759\u6001\u53d8\u91cf\u8d4b\u503c\u548c\u9759\u6001\u4ee3\u7801\u5757<\/td>\n<\/tr>\n<tr>\n<td>\u7c7b\u52a0\u8f7d\u5668<\/td>\n<td>Bootstrap\u3001Extension\u3001Application<\/td>\n<\/tr>\n<tr>\n<td>\u53cc\u4eb2\u59d4\u6d3e<\/td>\n<td>\u6536\u5230\u8bf7\u6c42\u5148\u59d4\u6d3e\u7ed9\u7236\u7c7b&#xff0c;\u7236\u7c7b\u65e0\u6cd5\u52a0\u8f7d\u518d\u7531\u5b50\u7c7b\u52a0\u8f7d<\/td>\n<\/tr>\n<tr>\n<td>\u53cc\u4eb2\u59d4\u6d3e\u4f18\u70b9<\/td>\n<td>\u4fdd\u8bc1\u6838\u5fc3\u7c7b\u5e93\u5b89\u5168\u3001\u907f\u514d\u7c7b\u91cd\u590d\u52a0\u8f7d<\/td>\n<\/tr>\n<tr>\n<td>\u6253\u7834\u53cc\u4eb2\u59d4\u6d3e<\/td>\n<td>\u7ebf\u7a0b\u4e0a\u4e0b\u6587\u7c7b\u52a0\u8f7d\u5668&#xff08;SPI&#xff09;\u3001Tomcat \u7b49\u81ea\u5b9a\u4e49\u5bb9\u5668<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u638c\u63e1\u7c7b\u52a0\u8f7d\u8fc7\u7a0b\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b&#xff0c;\u4e0d\u4ec5\u80fd\u5e2e\u4f60\u4ece\u5bb9\u5e94\u5bf9\u9762\u8bd5&#xff0c;\u66f4\u80fd\u8ba9\u4f60\u5728\u6392\u67e5 ClassNotFoundException\u3001NoClassDefFoundError\u3001ClassCastException&#xff08;\u540c\u4e00\u4e2a\u7c7b\u88ab\u4e0d\u540c\u52a0\u8f7d\u5668\u52a0\u8f7d\u5bfc\u81f4\u4e0d\u76f8\u7b49&#xff09;\u7b49\u7591\u96be\u6742\u75c7\u65f6&#xff0c;\u505a\u5230\u5bf9\u75c7\u4e0b\u836f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b<br \/>\n\u5728 Java \u7684\u4e16\u754c\u91cc&#xff0c;\u6709\u4e00\u53e5\u8457\u540d\u7684\u53e3\u53f7&#xff1a;\u201c\u4e00\u6b21\u7f16\u5199&#xff0c;\u5230\u5904\u8fd0\u884c&#xff08;Write Once, Run Anywhere&#xff09;\u201d\u3002\u652f\u6491\u8fd9\u4e00\u7279\u6027\u7684\u6838\u5fc3\u57fa\u77f3\u4e4b\u4e00&#xff0c;\u5c31\u662f JVM \u7684\u7c7b\u52a0\u8f7d\u673a\u5236\u3002<br \/>\n\u4e0e C\/C \u9700\u8981\u5728\u7f16\u8bd1\u65f6\u8fdb\u884c\u94fe\u63a5\u4e0d\u540c&#xff0c;Java \u5c06\u7c7b\u7684\u52a0\u8f7d\u3001\u8fde\u63a5\u548c\u521d\u59cb\u5316\u653e\u5728\u4e86\u8fd0\u884c\u671f\u3002\u8fd9\u79cd\u52a8\u6001\u52a0\u8f7d\u673a\u5236\u8d4b\u4e88\u4e86 Java \u6781\u5927\u7684\u7075\u6d3b\u6027&#xff08;\u5982\u53cd\u5c04\u3001\u70ed\u90e8<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,426],"topic":[],"class_list":["post-120072","post","type-post","status-publish","format-standard","hentry","category-server","tag-java","tag-jvm"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/120072.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b \u5728 Java \u7684\u4e16\u754c\u91cc&#xff0c;\u6709\u4e00\u53e5\u8457\u540d\u7684\u53e3\u53f7&#xff1a;\u201c\u4e00\u6b21\u7f16\u5199&#xff0c;\u5230\u5904\u8fd0\u884c&#xff08;Write Once, Run Anywhere&#xff09;\u201d\u3002\u652f\u6491\u8fd9\u4e00\u7279\u6027\u7684\u6838\u5fc3\u57fa\u77f3\u4e4b\u4e00&#xff0c;\u5c31\u662f JVM \u7684\u7c7b\u52a0\u8f7d\u673a\u5236\u3002 \u4e0e C\/C \u9700\u8981\u5728\u7f16\u8bd1\u65f6\u8fdb\u884c\u94fe\u63a5\u4e0d\u540c&#xff0c;Java \u5c06\u7c7b\u7684\u52a0\u8f7d\u3001\u8fde\u63a5\u548c\u521d\u59cb\u5316\u653e\u5728\u4e86\u8fd0\u884c\u671f\u3002\u8fd9\u79cd\u52a8\u6001\u52a0\u8f7d\u673a\u5236\u8d4b\u4e88\u4e86 Java \u6781\u5927\u7684\u7075\u6d3b\u6027&#xff08;\u5982\u53cd\u5c04\u3001\u70ed\u90e8\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/120072.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-30T17:48:31+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/120072.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/120072.html\",\"name\":\"\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-30T17:48:31+00:00\",\"dateModified\":\"2026-10-30T17:48:31+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/120072.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/120072.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/120072.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/120072.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b \u5728 Java \u7684\u4e16\u754c\u91cc&#xff0c;\u6709\u4e00\u53e5\u8457\u540d\u7684\u53e3\u53f7&#xff1a;\u201c\u4e00\u6b21\u7f16\u5199&#xff0c;\u5230\u5904\u8fd0\u884c&#xff08;Write Once, Run Anywhere&#xff09;\u201d\u3002\u652f\u6491\u8fd9\u4e00\u7279\u6027\u7684\u6838\u5fc3\u57fa\u77f3\u4e4b\u4e00&#xff0c;\u5c31\u662f JVM \u7684\u7c7b\u52a0\u8f7d\u673a\u5236\u3002 \u4e0e C\/C \u9700\u8981\u5728\u7f16\u8bd1\u65f6\u8fdb\u884c\u94fe\u63a5\u4e0d\u540c&#xff0c;Java \u5c06\u7c7b\u7684\u52a0\u8f7d\u3001\u8fde\u63a5\u548c\u521d\u59cb\u5316\u653e\u5728\u4e86\u8fd0\u884c\u671f\u3002\u8fd9\u79cd\u52a8\u6001\u52a0\u8f7d\u673a\u5236\u8d4b\u4e88\u4e86 Java \u6781\u5927\u7684\u7075\u6d3b\u6027&#xff08;\u5982\u53cd\u5c04\u3001\u70ed\u90e8","og_url":"https:\/\/www.wsisp.com\/helps\/120072.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-30T17:48:31+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/120072.html","url":"https:\/\/www.wsisp.com\/helps\/120072.html","name":"\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-30T17:48:31+00:00","dateModified":"2026-10-30T17:48:31+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/120072.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/120072.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/120072.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6df1\u5165\u7406\u89e3 Java \u7c7b\u52a0\u8f7d\u673a\u5236\u4e0e\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/120072","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=120072"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/120072\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=120072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=120072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=120072"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=120072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}