{"id":853,"date":"2026-03-02T21:09:32","date_gmt":"2026-03-02T13:09:32","guid":{"rendered":"http:\/\/47.100.165.17\/wordpress\/?p=853"},"modified":"2026-03-02T21:09:33","modified_gmt":"2026-03-02T13:09:33","slug":"%e3%80%90java%e3%80%91%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b%e8%bd%ac%e6%8d%a2%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/yunyanglib.cn\/?p=853","title":{"rendered":"\u3010Java\u3011\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u8be6\u89e3"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5927\u5bb6\u597d\uff0c\u6211\u662f\u4e91\u626c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728 Java \u57fa\u7840\u5b66\u4e60\u4e2d\uff0c<strong>\u6570\u636e\u7c7b\u578b\u8f6c\u6362<\/strong>\u662f\u975e\u5e38\u9ad8\u9891\u3001\u4e5f\u7279\u522b\u5bb9\u6613\u8e29\u5751\u7684\u77e5\u8bc6\u70b9\u3002\u4e0d\u7ba1\u662f\u65e5\u5e38\u7f16\u7801\u8fd8\u662f\u9762\u8bd5\u57fa\u7840\u9898\uff0c\u90fd\u4f1a\u9891\u7e41\u9047\u5230\u3002\u4eca\u5929\u5c31\u628a\u81ea\u52a8\u7c7b\u578b\u8f6c\u6362\u548c\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u4e00\u6b21\u6027\u8bb2\u6e05\u695a\uff0c\u65b0\u624b\u4e5f\u80fd\u8f7b\u677e\u770b\u61c2\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u3001\u81ea\u52a8\u7c7b\u578b\u8f6c\u6362\uff08\u81ea\u52a8\u7c7b\u578b\u63d0\u5347\uff09<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u81ea\u52a8\u7c7b\u578b\u8f6c\u6362\uff0c\u662f\u7f16\u8bd1\u5668\u5728<strong>\u4e0d\u9700\u8981\u6211\u4eec\u624b\u52a8\u5199\u4ee3\u7801<\/strong>\u7684\u60c5\u51b5\u4e0b\uff0c\u81ea\u52a8\u628a\u4e00\u79cd\u57fa\u672c\u6570\u636e\u7c7b\u578b\u8f6c\u6210\u53e6\u4e00\u79cd\u7684\u8fc7\u7a0b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u6838\u5fc3\u8f6c\u6362\u89c4\u5219<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd0\u7b97\u65f6\uff0c\u7c7b\u578b\u4f1a\u81ea\u52a8\u5f80\u300c\u8303\u56f4\u66f4\u5927\u300d\u7684\u7c7b\u578b\u5bf9\u9f50\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6709 <code>double<\/code> \u2192 \u5168\u8f6c <code>double<\/code><\/li>\n\n\n\n<li>\u65e0 <code>double<\/code>\u3001\u6709 <code>float<\/code> \u2192 \u5168\u8f6c <code>float<\/code><\/li>\n\n\n\n<li>\u65e0 <code>float<\/code>\u3001\u6709 <code>long<\/code> \u2192 \u5168\u8f6c <code>long<\/code><\/li>\n\n\n\n<li>\u4ee5\u4e0a\u90fd\u6ca1\u6709 \u2192 \u5168\u8f6c <code>int<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u6807\u51c6\u8f6c\u6362\u987a\u5e8f<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>byte \u2192 short \u2192 int \u2192 long \u2192 float \u2192 double\nchar \u2192 int \u2192 long \u2192 float \u2192 double\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u53ea\u6709<strong>\u7c7b\u578b\u517c\u5bb9\u3001\u5c0f\u8303\u56f4\u8f6c\u5927\u8303\u56f4<\/strong>\u65f6\uff0c\u624d\u4f1a\u81ea\u52a8\u8f6c\u6362\uff0c\u662f\u5b89\u5168\u7684\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u7279\u6b8a\u70b9\uff1achar \u5f88\u7279\u522b<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>char<\/code> \u53ef\u4ee5\u81ea\u52a8\u8f6c\u6210 <code>int\/long\/float\/double<\/code><\/li>\n\n\n\n<li>\u4f46 <code>byte\/short<\/code> \u4e0d\u80fd\u81ea\u52a8\u8f6c <code>char<\/code><\/li>\n\n\n\n<li><code>char<\/code> \u4e5f\u4e0d\u80fd\u81ea\u52a8\u8f6c <code>byte\/short<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4. \u65b0\u624b\u6700\u5bb9\u6613\u9519\u7684\u4f8b\u5b50<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u62a5\u9519\uff1a\u4e0d\u517c\u5bb9\u7684\u7c7b\u578b\uff0cint \u65e0\u6cd5\u8f6c\u6362\u4e3a byte\nbyte b = 50;\nb = b * 2;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u539f\u56e0\uff1a<code>b*2<\/code> \u4f1a\u81ea\u52a8\u63d0\u5347\u4e3a <code>int<\/code>\uff0c\u518d\u8d4b\u503c\u7ed9 <code>byte<\/code> \u5c31\u4e0d\u5339\u914d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f46\u4e0b\u9762\u8fd9\u79cd\u5199\u6cd5\u662f\u53ef\u4ee5\u7684\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>byte b = 50;\nb *= 2; \/\/ \u6b63\u5e38\u8fd0\u884c\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u56e0\u4e3a <code>b *= 2<\/code> \u7b49\u4ef7\u4e8e <code>b = (byte)(b * 2)<\/code>\uff0c\u7f16\u8bd1\u5668<strong>\u81ea\u52a8\u5e2e\u6211\u4eec\u505a\u4e86\u5f3a\u5236\u8f6c\u6362<\/strong>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u53e6\u5916\uff0c\u50cf <code>byte b = 50;<\/code> \u80fd\u76f4\u63a5\u8d4b\u503c\uff0c\u662f\u56e0\u4e3a 50 \u5728 <code>byte<\/code> \u8303\u56f4\u5185\uff0c\u7f16\u8bd1\u5668\u505a\u4e86\u9690\u5f0f\u4f18\u5316\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u662f<strong>\u663e\u5f0f\u8f6c\u6362<\/strong>\uff0c\u9700\u8981\u6211\u4eec\u624b\u52a8\u6307\u5b9a\u7c7b\u578b\uff0c\u8bed\u6cd5\uff1a<code>(\u76ee\u6807\u7c7b\u578b) \u53d8\u91cf\/\u503c<\/code>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u4ec0\u4e48\u65f6\u5019\u8981\u7528\uff1f<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5927\u8303\u56f4\u7c7b\u578b \u2192 \u5c0f\u8303\u56f4\u7c7b\u578b\uff08\u5982 <code>long<\/code> \u2192 <code>int<\/code>\uff09<\/li>\n\n\n\n<li>\u6d6e\u70b9\u6570 \u2192 \u6574\u6570\uff08\u5982 <code>double<\/code> \u2192 <code>int<\/code>\uff09<\/li>\n\n\n\n<li>\u5b57\u7b26\u578b \u2194 \u6570\u503c\u578b\u4e92\u8f6c<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u5f3a\u5236\u8f6c\u6362\u987a\u5e8f<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>double \u2192 float \u2192 long \u2192 int \u2192 char \u2192 short \u2192 byte\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u91cd\u8981\u63d0\u9192<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f3a\u5236\u8f6c\u6362<strong>\u53ef\u80fd\u4e22\u5931\u7cbe\u5ea6\u3001\u6570\u636e\u6ea2\u51fa<\/strong>\uff0c\u4f7f\u7528\u524d\u4e00\u5b9a\u8981\u4fdd\u8bc1\u503c\u5728\u76ee\u6807\u7c7b\u578b\u8303\u56f4\u5185\uff0c\u4e0d\u8981\u76f2\u76ee\u5f3a\u8f6c\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u603b\u7ed3<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u81ea\u52a8\u8f6c\u6362\uff1a\u5c0f\u2192\u5927\uff0c\u5b89\u5168\uff0c\u7f16\u8bd1\u5668\u81ea\u52a8\u5b8c\u6210\uff1b<\/li>\n\n\n\n<li>\u5f3a\u5236\u8f6c\u6362\uff1a\u5927\u2192\u5c0f\uff0c\u624b\u52a8\u5199\uff0c\u53ef\u80fd\u4e22\u7cbe\u5ea6\uff1b<\/li>\n\n\n\n<li>\u8fd0\u7b97\u65f6\u9ed8\u8ba4\u5f80 <code>int<\/code> \u53ca\u4ee5\u4e0a\u63d0\u5347\uff0c<code>byte\/short<\/code> \u8fd0\u7b97\u8981\u7279\u522b\u6ce8\u610f\u3002<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Java \u57fa\u7840\u770b\u4f3c\u7b80\u5355\uff0c\u7ec6\u8282\u7279\u522b\u591a\u3002\u540e\u9762\u6211\u4f1a\u7ee7\u7eed\u66f4\u65b0 Java \u5165\u95e8\u6838\u5fc3\u77e5\u8bc6\u70b9\uff0c\u5305\u62ec\u53d8\u91cf\u3001\u8fd0\u7b97\u7b26\u3001\u6d41\u7a0b\u63a7\u5236\u7b49\uff0c\u5e2e\u5927\u5bb6\u4e00\u6b65\u6b65\u6253\u597d\u57fa\u7840\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u662f\u4e91\u626c\uff0c\u6211\u4eec\u4e0b\u7bc7\u518d\u89c1\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u6211\u662f\u4e91\u626c\u3002 \u5728 Java \u57fa\u7840\u5b66\u4e60\u4e2d\uff0c\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u662f\u975e\u5e38\u9ad8\u9891\u3001\u4e5f\u7279\u522b\u5bb9\u6613\u8e29\u5751\u7684\u77e5\u8bc6\u70b9\u3002\u4e0d\u7ba1\u662f\u65e5\u5e38\u7f16\u7801\u8fd8<\/p>\n<div class=\"more-link\">\n\t\t\t\t <a href=\"https:\/\/yunyanglib.cn\/?p=853\" class=\"link-btn theme-btn\"><span>Read More <\/span> <i class=\"fa fa-caret-right\"><\/i><\/a>\n\t\t\t<\/div>\n","protected":false},"author":1,"featured_media":856,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[15],"class_list":["post-853","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-java"],"_links":{"self":[{"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/posts\/853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=853"}],"version-history":[{"count":2,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/posts\/853\/revisions"}],"predecessor-version":[{"id":855,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/posts\/853\/revisions\/855"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=\/wp\/v2\/media\/856"}],"wp:attachment":[{"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yunyanglib.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}