{"id":64170,"date":"2025-05-03T14:07:31","date_gmt":"2025-05-03T06:07:31","guid":{"rendered":"https:\/\/fwq.ai\/blog\/64170\/"},"modified":"2025-05-03T14:07:31","modified_gmt":"2025-05-03T06:07:31","slug":"java-%e4%b8%ad%e8%bf%90%e7%ae%97%e7%ac%a6%e4%b8%ba%e4%bd%95%e4%bc%9a%e5%bc%95%e5%8f%91%e7%bc%96%e8%af%91%e9%94%99%e8%af%af%ef%bc%9f-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/64170\/","title":{"rendered":"Java \u4e2d\u201c+=\u201d\u8fd0\u7b97\u7b26\u4e3a\u4f55\u4f1a\u5f15\u53d1\u7f16\u8bd1\u9519\u8bef\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173053746697513.jpg\" class=\"aligncenter\" title=\"Java \u4e2d\u201c+=\u201d\u8fd0\u7b97\u7b26\u4e3a\u4f55\u4f1a\u5f15\u53d1\u7f16\u8bd1\u9519\u8bef\uff1f\u63d2\u56fe\" alt=\"Java \u4e2d\u201c+=\u201d\u8fd0\u7b97\u7b26\u4e3a\u4f55\u4f1a\u5f15\u53d1\u7f16\u8bd1\u9519\u8bef\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>java \u4e2d\u201c+=\u201d\u8fd0\u7b97\u7b26\u7684\u56f0\u60d1<\/strong><\/p>\n<p>\u5728 java \u4e2d\uff0c\u201c+=\u201d\u8fd0\u7b97\u7b26\u7528\u4e8e\u5bf9\u53d8\u91cf\u8fdb\u884c\u7d2f\u52a0\u8fd0\u7b97\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u5bf9\u4e8e\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff0c\u4f8b\u5982 int \u7c7b\u578b\u53d8\u91cf x\uff0c\u4e0b\u5217\u4e24\u79cd\u5199\u6cd5\u662f\u7b49\u4ef7\u7684\uff1a<\/p>\n<pre>x += 1;\nx = x + 1;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u800c\uff0c\u95ee\u9898\u4e2d\u63d0\u5230\u7684\u4ee5\u4e0b\u4ee3\u7801\u4f1a\u5f15\u53d1\u7f16\u8bd1\u65f6\u9519\u8bef\uff1a<\/p>\n<pre>x = x + Math.random() * 10;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d x \u4e3a int \u7c7b\u578b\u53d8\u91cf\uff0cmath.random() \u8fd4\u56de\u4e00\u4e2a [0, 1) \u8303\u56f4\u5185\u7684\u6d6e\u70b9\u6570\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u539f\u56e0\u53ca\u201c+=\u201d\u8fd0\u7b97\u7b26\u7684\u9690\u85cf\u7279\u6027<\/strong><\/p>\n<p>\u8fd9\u79cd\u5dee\u5f02\u662f\u7531 java \u8bed\u8a00\u89c4\u8303\u4e2d\u5bf9\u590d\u5408\u8d4b\u503c\u8fd0\u7b97\u7b26\u201c+=\u201d\u7684\u89c4\u5b9a\u6240\u81f4\u3002\u89c4\u8303\u89c4\u5b9a\uff0c\u201c+=\u201d\u8fd0\u7b97\u7b26\u5728\u6267\u884c\u8d4b\u503c\u64cd\u4f5c\u4e4b\u524d\u4f1a\u5bf9\u53f3\u64cd\u4f5c\u6570\u8fdb\u884c\uff0c\u4f7f\u5176\u4e0e\u5de6\u64cd\u4f5c\u6570\u7684\u7c7b\u578b\u5339\u914d\u3002<\/p>\n<p>\u5728\u6211\u4eec\u7ed9\u51fa\u7684\u793a\u4f8b\u4e2d\uff0cx \u4e3a int \u7c7b\u578b\uff0cmath.random() * 10 \u7684\u7ed3\u679c\u662f\u4e00\u4e2a\u6d6e\u70b9\u6570\u3002\u6839\u636e\u89c4\u8303\uff0c\u518d\u8fdb\u884c\u8d4b\u503c\u64cd\u4f5c\u4e4b\u524d\uff0c\u6d6e\u70b9\u6570\u4f1a\u8f6c\u6362\u4e3a int \u7c7b\u578b\uff0c\u800c\u8f6c\u6362\u89c4\u5219\u662f\u820d\u5165\u4e3a\u6700\u8fd1\u7684\u6574\u6570\u3002<\/p>\n<p>\u5bf9\u4e8e\u201c*=\u201d\u8fd0\u7b97\u7b26\u7b49\u5176\u4ed6\u590d\u5408\u8d4b\u503c\u8fd0\u7b97\u7b26\uff0c\u4e5f\u6709\u7c7b\u4f3c\u7684\u8f6c\u6362\u89c4\u5219\u3002<\/p>\n<p><strong>\u4f18\u70b9\u548c\u7f3a\u70b9<\/strong><\/p>\n<p>\u8fd9\u4e2a\u7279\u6027\u6709\u5229\u6709\u5f0a\uff1a<\/p>\n<p><strong>\u4f18\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u65b9\u4fbf\u7b80\u6d01\uff0c\u65e0\u9700\u663e\u5f0f\u7c7b\u578b\u8f6c\u6362\u3002<\/li>\n<li>\u786e\u4fdd\u64cd\u4f5c\u6570\u7c7b\u578b\u4e00\u81f4\u3002<\/li>\n<\/ul>\n<p><strong>\u7f3a\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u53ef\u80fd\u5bfc\u81f4\u7cbe\u5ea6\u635f\u5931\uff0c\u5c24\u5176\u662f\u5f53\u6d89\u53ca\u6d6e\u70b9\u8fd0\u7b97\u65f6\u3002<\/li>\n<li>\u7f16\u8bd1\u65f6\u53ef\u80fd\u4f1a\u51fa\u73b0\u610f\u5916\u9519\u8bef\uff0c\u5982\u6211\u4eec\u5728\u793a\u4f8b\u4e2d\u9047\u5230\u7684\u95ee\u9898\u3002<\/li>\n<\/ul>\n<p>\u56e0\u6b64\uff0c\u5728\u4f7f\u7528\u201c+=\u201d\u8fd0\u7b97\u7b26\u65f6\uff0c\u9700\u8981\u5145\u5206\u8003\u8651\u6570\u636e\u7c7b\u578b\u53ca\u5176\u5bf9\u7cbe\u5ea6\u548c\u9519\u8bef\u5904\u7406\u7684\u5f71\u54cd\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fJava \u4e2d\u201c+=\u201d\u8fd0\u7b97\u7b26\u4e3a\u4f55\u4f1a\u5f15\u53d1\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8IDCBABY\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>java \u4e2d\u201c+=\u201d\u8fd0\u7b97\u7b26\u7684\u56f0\u60d1 \u5728 java \u4e2d\uff0c\u201c+=\u201d\u8fd0\u7b97\u7b26\u7528\u4e8e\u5bf9\u53d8\u91cf\u8fdb\u884c\u7d2f\u52a0\u8fd0\u7b97\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u5bf9\u4e8e\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff0c\u4f8b\u5982 int \u7c7b\u578b\u53d8\u91cf x\uff0c\u4e0b\u5217\u4e24\u79cd\u5199\u6cd5\u662f\u7b49\u4ef7\u7684\uff1a x += 1; x = x + 1; \u767b\u5f55\u540e\u590d\u5236 \u7136\u800c\uff0c\u95ee\u9898\u4e2d\u63d0\u5230\u7684\u4ee5\u4e0b\u4ee3\u7801\u4f1a\u5f15\u53d1\u7f16\u8bd1\u65f6\u9519\u8bef\uff1a x = x + Math.random() * 10; \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d x \u4e3a int \u7c7b\u578b\u53d8\u91cf\uff0cmath.random() \u8fd4\u56de\u4e00\u4e2a [0, 1) \u8303\u56f4\u5185\u7684\u6d6e\u70b9\u6570\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u539f\u56e0\u53ca\u201c+=\u201d\u8fd0\u7b97\u7b26\u7684\u9690\u85cf\u7279\u6027 \u8fd9\u79cd\u5dee\u5f02\u662f\u7531 java \u8bed\u8a00\u89c4\u8303\u4e2d\u5bf9\u590d\u5408\u8d4b\u503c\u8fd0\u7b97\u7b26\u201c+=\u201d\u7684\u89c4\u5b9a\u6240\u81f4\u3002\u89c4\u8303\u89c4\u5b9a\uff0c\u201c+=\u201d\u8fd0\u7b97\u7b26\u5728\u6267\u884c\u8d4b\u503c\u64cd\u4f5c\u4e4b\u524d\u4f1a\u5bf9\u53f3\u64cd\u4f5c\u6570\u8fdb\u884c\uff0c\u4f7f\u5176\u4e0e\u5de6\u64cd\u4f5c\u6570\u7684\u7c7b\u578b\u5339\u914d\u3002 \u5728\u6211\u4eec\u7ed9\u51fa\u7684\u793a\u4f8b\u4e2d\uff0cx \u4e3a int \u7c7b\u578b\uff0cmath.random() * 10 \u7684\u7ed3\u679c\u662f\u4e00\u4e2a\u6d6e\u70b9\u6570\u3002\u6839\u636e\u89c4\u8303\uff0c\u518d\u8fdb\u884c\u8d4b\u503c\u64cd\u4f5c\u4e4b\u524d\uff0c\u6d6e\u70b9\u6570\u4f1a\u8f6c\u6362\u4e3a int \u7c7b\u578b\uff0c\u800c\u8f6c\u6362\u89c4\u5219\u662f\u820d\u5165\u4e3a\u6700\u8fd1\u7684\u6574\u6570\u3002 \u5bf9\u4e8e\u201c*=\u201d\u8fd0\u7b97\u7b26\u7b49\u5176\u4ed6\u590d\u5408\u8d4b\u503c\u8fd0\u7b97\u7b26\uff0c\u4e5f\u6709\u7c7b\u4f3c\u7684\u8f6c\u6362\u89c4\u5219\u3002 \u4f18\u70b9\u548c\u7f3a\u70b9 \u8fd9\u4e2a\u7279\u6027\u6709\u5229\u6709\u5f0a\uff1a \u4f18\u70b9\uff1a \u65b9\u4fbf\u7b80\u6d01\uff0c\u65e0\u9700\u663e\u5f0f\u7c7b\u578b\u8f6c\u6362\u3002 \u786e\u4fdd\u64cd\u4f5c\u6570\u7c7b\u578b\u4e00\u81f4\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-64170","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=64170"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64170\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=64170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=64170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=64170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}