{"id":3748,"date":"2024-02-22T09:01:02","date_gmt":"2024-02-22T01:01:02","guid":{"rendered":""},"modified":"2024-02-22T09:01:02","modified_gmt":"2024-02-22T01:01:02","slug":"Java\u5165\u95e8\u4e4b~Java\u57fa\u7840\u8bed\u6cd5","status":"publish","type":"post","link":"https:\/\/mushiming.com\/3748.html","title":{"rendered":"Java\u5165\u95e8\u4e4b~Java\u57fa\u7840\u8bed\u6cd5"},"content":{"rendered":"

\n <\/path> \n<\/svg> <\/p>\n

\n

\u2728\u2728\u2728\u2728\u2728\u2728\u2728\u2728\u2728\u6bcf\u7bc7\u524d\u8a00<\/strong>\u2728\u2728\u2728\u2728\u2728\u2728\u2728\u2728\u2728
\u535a\u5ba2\u4e3b\u9875\uff1aAra~\u8ffd\u7740\u98ce\u8dd1
\u52b1\u5fd7\u8bed\u5f55\uff1a\ud83d\udc49\u52e4\u594b\u662f\u4f60\u751f\u547d\u7684\u5bc6\u7801\uff0c\u80fd\u8bd1\u51fa\u4f60\u4e00\u90e8\u58ee\u4e3d\u7684\u53f2\u8bd7\u3002\ud83d\udc48
\u6bcf\u65e5\u5ba3\u8a00\uff1a\u6bcf\u65e5\u770b\u4e66\u4e94\u5c0f\u65f6\uff0c\ud83d\udc49\u4e0d\u670d\u4ee3\u7801\u4e0d\u8d1f\u537f\u6765\u81ea\u5b89\u7136\u5927\u54e5\u8bed\u5f55\ud83d\udc48
Now\uff01\uff01Let\u2019s get it\uff01\uff01\uff01\uff01\u51b2\ud83d\udc31\u200d\ud83c\udfcd\ud83d\udc31\u200d\ud83c\udfcd\ud83d\udc31\u200d\ud83c\udfcd
\"Java\u5165\u95e8\u4e4b~Java\u57fa\u7840\u8bed\u6cd5<\/p>\n<\/blockquote>\n

\ud83d\udc49Java\u5165\u95e8\u4e4b - java\u57fa\u7840\u8bed\u6cd5\ud83d\udc48<\/h2>\n

\ud83d\udc491. Java\u6982\u8ff0\ud83d\udc48<\/h2>\n

1.1 Java\u8bed\u8a00\u53d1\u5c55\u53f2\uff08\u4e86\u89e3\uff09<\/h4>\n
\n

\u8bed\u8a00\uff1a\u4eba\u4e0e\u4eba\u4ea4\u6d41\u6c9f\u901a\u7684\u8868\u8fbe\u65b9\u5f0f<\/p>\n

\u8ba1\u7b97\u673a\u8bed\u8a00\uff1a\u4eba\u4e0e\u8ba1\u7b97\u673a\u4e4b\u95f4\u8fdb\u884c\u4fe1\u606f\u4ea4\u6d41\u6c9f\u901a\u7684\u4e00\u79cd\u7279\u6b8a\u8bed\u8a00<\/p>\n

Java\u8bed\u8a00\u662f\u7f8e\u56fdSun\u516c\u53f8\uff08Stanford University Network\uff09\u57281995\u5e74\u63a8\u51fa\u7684\u8ba1\u7b97\u673a\u8bed\u8a00<\/p>\n

Java\u4e4b\u7236\uff1a\u8a79\u59c6\u65af\u00b7\u9ad8\u65af\u6797\uff08James Gosling\uff09<\/p>\n

2009\u5e74\uff0cSun\u516c\u53f8\u88ab\u7532\u9aa8\u6587\u516c\u53f8\u6536\u8d2d\uff0c\u6240\u4ee5\u6211\u4eec\u73b0\u5728\u8bbf\u95eeoracle\u5b98\u7f51\u5373\u53ef\uff1ahttps:\/\/www.oracle.com<\/p>\n

\u5f53\u524d\uff0c\u6211\u4eec\u8bfe\u7a0b\u4f7f\u7528\u7684JDK\u7248\u672c\uff1a11.0<\/p>\n<\/blockquote>\n

1.2 Java\u8bed\u8a00\u8de8\u5e73\u53f0\u539f\u7406\uff08\u7406\u89e3\uff09<\/h4>\n
\n

Java\u7a0b\u5e8f\u5e76\u975e\u662f\u76f4\u63a5\u8fd0\u884c\u7684\uff0cJava\u7f16\u8bd1\u5668\u5c06Java\u6e90\u7a0b\u5e8f\u7f16\u8bd1\u6210\u4e0e\u5e73\u53f0\u65e0\u5173\u7684\u5b57\u8282\u7801\u6587\u4ef6(class\u6587\u4ef6)\uff0c\u7136\u540e\u7531Java\u865a\u62df\u673a\uff08JVM\uff09\u5bf9\u5b57\u8282\u7801\u6587\u4ef6\u89e3\u91ca\u6267\u884c\u3002\u6240\u4ee5\u5728\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0b\uff0c\u53ea\u9700\u5b89\u88c5\u4e0d\u540c\u7684Java\u865a\u62df\u673a\u5373\u53ef\u5b9e\u73b0java\u7a0b\u5e8f\u7684\u8de8\u5e73\u53f0\u3002<\/p>\n<\/blockquote>\n

1.3 JRE\u548cJDK\uff08\u8bb0\u5fc6\uff09<\/h4>\n
\n

JVM\uff08Java Virtual Machine\uff09\uff0cJava\u865a\u62df\u673a<\/p>\n

JRE\uff08Java Runtime Environment\uff09\uff0cJava\u8fd0\u884c\u73af\u5883\uff0c\u5305\u542b\u4e86JVM\u548cJava\u7684\u6838\u5fc3\u7c7b\u5e93\uff08Java API\uff09<\/p>\n

JDK\uff08Java Development Kit\uff09\u79f0\u4e3aJava\u5f00\u53d1\u5de5\u5177\uff0c\u5305\u542b\u4e86JRE\u548c\u5f00\u53d1\u5de5\u5177<\/p>\n

\u603b\u7ed3\uff1a\u6211\u4eec\u53ea\u9700\u5b89\u88c5JDK\u5373\u53ef\uff0c\u5b83\u5305\u542b\u4e86java\u7684\u8fd0\u884c\u73af\u5883\u548c\u865a\u62df\u673a\u3002<\/p>\n<\/blockquote>\n

1.4 JDK\u7684\u4e0b\u8f7d\u548c\u5b89\u88c5\uff08\u5e94\u7528\uff09<\/h4>\n

1.4.1 \u4e0b\u8f7d<\/h5>\n
\n

\u901a\u8fc7\u5b98\u65b9\u7f51\u7ad9\u83b7\u53d6JDK<\/p>\n

http:\/\/www.oracle.com<\/p>\n

\u6ce8\u610f<\/strong>\uff1a\u9488\u5bf9\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u9700\u8981\u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c\u7684JDK\u3002<\/p>\n

\u5177\u4f53\u4e0b\u8f7d\u6b65\u9aa4\u8bf7\u53c2\u89c1\u300aJDK\u4e0b\u8f7d\u53ca\u5b89\u88c5\u8bf4\u660e\u6587\u6863\u300b<\/p>\n<\/blockquote>\n

1.4.2 \u5b89\u88c5<\/h5>\n
\n

\u50bb\u74dc\u5f0f\u5b89\u88c5\uff0c\u4e0b\u4e00\u6b65\u5373\u53ef\u3002\u4f46\u9ed8\u8ba4\u7684\u5b89\u88c5\u8def\u5f84\u662f\u5728C:\\Program
Files\u4e0b\uff0c\u4e3a\u65b9\u4fbf\u7edf\u4e00\u7ba1\u7406\u5efa\u8bae\u4fee\u6539\u5b89\u88c5\u8def\u5f84\uff0c\u5c06\u4e0e\u5f00\u53d1\u76f8\u5173\u7684\u8f6f\u4ef6\u90fd\u5b89\u88c5\u5230\u4e00\u4e2a\u76ee\u5f55\u4e0b\uff0c\u4f8b\u5982\uff1aE:\\develop\u3002<\/p>\n

\u6ce8\u610f<\/strong>\uff1a\u5b89\u88c5\u8def\u5f84\u4e0d\u8981\u5305\u542b\u4e2d\u6587\u6216\u8005\u7a7a\u683c\u7b49\u7279\u6b8a\u5b57\u7b26\uff08\u4f7f\u7528\u7eaf\u82f1\u6587\u76ee\u5f55\uff09\u3002<\/p>\n

\u5177\u4f53\u5b89\u88c5\u6b65\u9aa4\u8bf7\u53c2\u89c1\u300aJDK\u4e0b\u8f7d\u53ca\u5b89\u88c5\u8bf4\u660e\u6587\u6863\u300b<\/p>\n<\/blockquote>\n

1.4.3 JDK\u7684\u5b89\u88c5\u76ee\u5f55\u4ecb\u7ecd<\/h5>\n\n\n\n\n\n\n\n\n\n\n
\u76ee\u5f55\u540d\u79f0<\/th>\n\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n
bin<\/td>\n\u8be5\u8def\u5f84\u4e0b\u5b58\u653e\u4e86JDK\u7684\u5404\u79cd\u5de5\u5177\u547d\u4ee4\u3002javac\u548cjava\u5c31\u653e\u5728\u8fd9\u4e2a\u76ee\u5f55\u3002<\/td>\n<\/tr>\n
conf<\/td>\n\u8be5\u8def\u5f84\u4e0b\u5b58\u653e\u4e86JDK\u7684\u76f8\u5173\u914d\u7f6e\u6587\u4ef6\u3002<\/td>\n<\/tr>\n
include<\/td>\n\u8be5\u8def\u5f84\u4e0b\u5b58\u653e\u4e86\u4e00\u4e9b\u5e73\u53f0\u7279\u5b9a\u7684\u5934\u6587\u4ef6\u3002<\/td>\n<\/tr>\n
jmods<\/td>\n\u8be5\u8def\u5f84\u4e0b\u5b58\u653e\u4e86JDK\u7684\u5404\u79cd\u6a21\u5757\u3002<\/td>\n<\/tr>\n
legal<\/td>\n\u8be5\u8def\u5f84\u4e0b\u5b58\u653e\u4e86JDK\u5404\u6a21\u5757\u7684\u6388\u6743\u6587\u6863\u3002<\/td>\n<\/tr>\n
lib<\/td>\n\u8be5\u8def\u5f84\u4e0b\u5b58\u653e\u4e86JDK\u5de5\u5177\u7684\u4e00\u4e9b\u8865\u5145JAR\u5305\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\ud83d\udc492. \u5165\u95e8\u7a0b\u5e8fHelloWorld\ud83d\udc48<\/h2>\n

2.1 \u5e38\u7528DOS\u547d\u4ee4\uff08\u5e94\u7528\uff09<\/h4>\n
\n

\u5728\u63a5\u89e6\u96c6\u6210\u5f00\u53d1\u73af\u5883\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u547d\u4ee4\u884c\u7a97\u53e3\u5bf9java\u7a0b\u5e8f\u8fdb\u884c\u7f16\u8bd1\u548c\u8fd0\u884c\uff0c\u6240\u4ee5\u9700\u8981\u77e5\u9053\u4e00\u4e9b\u5e38\u7528DOS\u547d\u4ee4\u3002<\/p>\n

1\u3001\u6253\u5f00\u547d\u4ee4\u884c\u7a97\u53e3\u7684\u65b9\u5f0f\uff1awin + r\u6253\u5f00\u8fd0\u884c\u7a97\u53e3\uff0c\u8f93\u5165cmd\uff0c\u56de\u8f66\u3002<\/p>\n

2\u3001\u5e38\u7528\u547d\u4ee4\u53ca\u5176\u4f5c\u7528<\/p>\n<\/blockquote>\n\n\n\n\n\n\n\n\n\n\n\n\n
\u64cd\u4f5c<\/th>\n\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n
\u76d8\u7b26\u540d\u79f0:<\/td>\n\u76d8\u7b26\u5207\u6362\u3002E:\u56de\u8f66\uff0c\u8868\u793a\u5207\u6362\u5230E\u76d8\u3002<\/td>\n<\/tr>\n
dir<\/td>\n\u67e5\u770b\u5f53\u524d\u8def\u5f84\u4e0b\u7684\u5185\u5bb9\u3002<\/td>\n<\/tr>\n
cd \u76ee\u5f55<\/td>\n\u8fdb\u5165\u5355\u7ea7\u76ee\u5f55\u3002cd itheima<\/td>\n<\/tr>\n
cd \u2026<\/td>\n\u56de\u9000\u5230\u4e0a\u4e00\u7ea7\u76ee\u5f55\u3002<\/td>\n<\/tr>\n
cd \u76ee\u5f551\\\u76ee\u5f552\u2026<\/td>\n\u8fdb\u5165\u591a\u7ea7\u76ee\u5f55\u3002cd itheima\\JavaSE<\/td>\n<\/tr>\n
cd \\<\/td>\n\u56de\u9000\u5230\u76d8\u7b26\u76ee\u5f55\u3002<\/td>\n<\/tr>\n
cls<\/td>\n\u6e05\u5c4f\u3002<\/td>\n<\/tr>\n
exit<\/td>\n\u9000\u51fa\u547d\u4ee4\u63d0\u793a\u7b26\u7a97\u53e3\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

2.2 Path\u73af\u5883\u53d8\u91cf\u7684\u914d\u7f6e\uff08\u5e94\u7528\uff09<\/h4>\n

2.2.1 \u4e3a\u4ec0\u4e48\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/h5>\n
\n

\u5f00\u53d1Java\u7a0b\u5e8f\uff0c\u9700\u8981\u4f7f\u7528JDK\u63d0\u4f9b\u7684\u5f00\u53d1\u5de5\u5177\uff08\u6bd4\u5982javac.exe\u3001java.exe\u7b49\u547d\u4ee4\uff09\uff0c\u800c\u8fd9\u4e9b\u5de5\u5177\u5728JDK\u7684\u5b89\u88c5\u76ee\u5f55\u7684bin\u76ee\u5f55\u4e0b\uff0c\u5982\u679c\u4e0d\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u90a3\u4e48\u8fd9\u4e9b\u547d\u4ee4\u53ea\u53ef\u4ee5\u5728\u8be5\u76ee\u5f55\u4e0b\u6267\u884c\u3002\u6211\u4eec\u4e0d\u53ef\u80fd\u628a\u6240\u6709\u7684java\u6587\u4ef6\u90fd\u653e\u5230JDK\u7684bin\u76ee\u5f55\u4e0b\uff0c\u6240\u4ee5\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u4f5c\u7528\u5c31\u662f\u53ef\u4ee5\u4f7fbin\u76ee\u5f55\u4e0b\u7684java\u76f8\u5173\u547d\u4ee4\u53ef\u4ee5\u5728\u4efb\u610f\u76ee\u5f55\u4e0b\u4f7f\u7528\u3002<\/p>\n

\u6ce8\u610f\uff1a\u76ee\u524d\u8f83\u65b0\u7684JDK\u5b89\u88c5\u65f6\u4f1a\u81ea\u52a8\u914d\u7f6ejavac\u3001java\u547d\u4ee4\u7684\u8def\u5f84\u5230Path\u73af\u5883\u53d8\u91cf\u4e2d\u53bb \uff0c\u6240\u4ee5javac\u3001java\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u3002<\/p>\n

\u4f46\u662f\u4ee5\u524d\u4e0b\u8f7d\u7684\u8001\u7248\u672c\u7684JDK\u662f\u6ca1\u6709\u81ea\u52a8\u914d\u7f6e\u7684\uff0c\u6b64\u65f6\u5fc5\u9700\u8981\u81ea\u5df1\u914d\u7f6ePath\u73af\u5883\u53d8\u91cf\u3002<\/p>\n

\u2460JAVA_HOME<\/strong>\uff1a\u544a\u8bc9\u64cd\u4f5c\u7cfb\u7edfJDK\u5b89\u88c5\u5728\u4e86\u54ea\u4e2a\u4f4d\u7f6e\uff08\u672a\u6765\u5176\u4ed6\u6280\u672f\u8981\u901a\u8fc7\u8fd9\u4e2a\u627eJDK\uff09<\/p>\n

\u2461Path<\/strong>\uff1a\u544a\u8bc9\u64cd\u4f5c\u7cfb\u7edfJDK\u63d0\u4f9b\u7684javac(\u7f16\u8bd1)\u3001java(\u6267\u884c)\u547d\u4ee4\u5b89\u88c5\u5230\u4e86\u54ea\u4e2a\u4f4d\u7f6e<\/p>\n

\u6ce8\u610f\uff1a\u65b0\u7248\u672c\u7684JDK\u53ea\u662f\u81ea\u52a8\u914d\u7f6e\u4e86Path\uff0c\u6ca1\u6709\u81ea\u52a8\u914d\u7f6eJAVA_HOME\u3002<\/strong><\/p>\n<\/blockquote>\n

2.3 HelloWorld\u6848\u4f8b\uff08\u5e94\u7528\uff09<\/h4>\n
\n

HelloWorld\u6848\u4f8b\u662f\u6307\u5728\u8ba1\u7b97\u673a\u5c4f\u5e55\u4e0a\u8f93\u51fa\u201cHelloWorld\u201d\u8fd9\u884c\u6587\u5b57\u3002\u5404\u79cd\u8ba1\u7b97\u673a\u8bed\u8a00\u90fd\u4e60\u60ef\u4f7f\u7528\u8be5\u6848\u4f8b\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u6f14\u793a\u6848\u4f8b\u3002<\/p>\n<\/blockquote>\n

2.3.1 Java\u7a0b\u5e8f\u5f00\u53d1\u8fd0\u884c\u6d41\u7a0b<\/h5>\n
\n

\u5f00\u53d1Java\u7a0b\u5e8f\uff0c\u9700\u8981\u4e09\u4e2a\u6b65\u9aa4\uff1a\u7f16\u5199\u7a0b\u5e8f\uff0c\u7f16\u8bd1\u7a0b\u5e8f\uff0c\u8fd0\u884c\u7a0b\u5e8f\u3002<\/p>\n<\/blockquote>\n

2.3.2 HelloWorld\u6848\u4f8b\u7684\u7f16\u5199<\/h5>\n
\n

1\u3001\u65b0\u5efa\u6587\u672c\u6587\u6863\u6587\u4ef6\uff0c\u4fee\u6539\u540d\u79f0\u4e3aHelloWorld.java\u3002<\/p>\n

2\u3001\u7528\u8bb0\u4e8b\u672c\u6253\u5f00HelloWorld.java\u6587\u4ef6\uff0c\u8f93\u5199\u7a0b\u5e8f\u5185\u5bb9\u3002<\/p>\n<\/blockquote>\n

public<\/span> class<\/span> HelloWorld<\/span> { \n   <\/span>\n\tpublic<\/span> static<\/span> void<\/span> main<\/span>(<\/span>String[<\/span>]<\/span> args)<\/span> { \n   <\/span>\n\t\tSystem.<\/span>out.<\/span>println<\/span>(<\/span>\"HelloWorld\"<\/span>)<\/span>;<\/span>\n\t}<\/span>\n}<\/span>\n<\/code><\/pre>\n
2.3.3 HelloWorld\u6848\u4f8b\u7684\u7f16\u8bd1\u548c\u8fd0\u884c<\/h5>\n

\u5b58\u6587\u4ef6\uff0c\u6253\u5f00\u547d\u4ee4\u884c\u7a97\u53e3\uff0c\u5c06\u76ee\u5f55\u5207\u6362\u81f3java\u6587\u4ef6\u6240\u5728\u76ee\u5f55\uff0c\u7f16\u8bd1java\u6587\u4ef6\u751f\u6210class\u6587\u4ef6\uff0c\u8fd0\u884cclass\u6587\u4ef6\u3002<\/p>\n

\n

\u7f16\u8bd1\uff1ajavac \u6587\u4ef6\u540d.java<\/p>\n

\u8303\u4f8b\uff1ajavac HelloWorld.java<\/p>\n

\u6267\u884c\uff1ajava \u7c7b\u540d<\/p>\n

\u8303\u4f8b\uff1ajava HelloWorld<\/p>\n<\/blockquote>\n

2.4 HelloWorld\u6848\u4f8b\u5e38\u89c1\u95ee\u9898\uff08\u7406\u89e3\uff09<\/h4>\n

2.4.1 BUG<\/h5>\n
\n

\u5728\u7535\u8111\u7cfb\u7edf\u6216\u7a0b\u5e8f\u4e2d\uff0c\u9690\u85cf\u7740\u7684\u4e00\u4e9b\u672a\u88ab\u53d1\u73b0\u7684\u7f3a\u9677\u6216\u95ee\u9898\u7edf\u79f0\u4e3abug\uff08\u6f0f\u6d1e\uff09\u3002<\/p>\n<\/blockquote>\n

2.4.2 BUG\u7684\u89e3\u51b3<\/h5>\n
\n

1\u3001\u5177\u5907\u8bc6\u522bBUG\u7684\u80fd\u529b\uff1a\u591a\u770b<\/p>\n

2\u3001\u5177\u5907\u5206\u6790BUG\u7684\u80fd\u529b\uff1a\u591a\u601d\u8003\uff0c\u591a\u67e5\u8d44\u6599<\/p>\n

3\u3001\u5177\u5907\u89e3\u51b3BUG\u7684\u80fd\u529b\uff1a\u591a\u5c1d\u8bd5\uff0c\u591a\u603b\u7ed3<\/p>\n<\/blockquote>\n

2.4.3 HelloWorld\u6848\u4f8b\u5e38\u89c1\u95ee\u9898<\/h5>\n
\n

1\u3001\u975e\u6cd5\u5b57\u7b26\u95ee\u9898\u3002Java\u4e2d\u7684\u7b26\u53f7\u90fd\u662f\u82f1\u6587\u683c\u5f0f\u7684\u3002<\/p>\n

2\u3001\u5927\u5c0f\u5199\u95ee\u9898\u3002Java\u8bed\u8a00\u5bf9\u5927\u5c0f\u5199\u654f\u611f\uff08\u533a\u5206\u5927\u5c0f\u5199\uff09\u3002<\/p>\n

3\u3001\u5728\u7cfb\u7edf\u4e2d\u663e\u793a\u6587\u4ef6\u7684\u6269\u5c55\u540d\uff0c\u907f\u514d\u51fa\u73b0HelloWorld.java.txt\u6587\u4ef6\u3002<\/p>\n

4\u3001\u7f16\u8bd1\u547d\u4ee4\u540e\u7684java\u6587\u4ef6\u540d\u9700\u8981\u5e26\u6587\u4ef6\u540e\u7f00.java<\/p>\n

5\u3001\u8fd0\u884c\u547d\u4ee4\u540e\u7684class\u6587\u4ef6\u540d\uff08\u7c7b\u540d\uff09\u4e0d\u5e26\u6587\u4ef6\u540e\u7f00.class<\/p>\n<\/blockquote>\n

\ud83d\udc493\u3001IDEA\u5b89\u88c5\u4f7f\u7528\ud83d\udc48<\/h2>\n

\u53c2\u89c1**\u201cIDEA\u5b89\u88c5\u8be6\u89e3\u201d**
\u8fd9\u91cc\u8fd9\u91cc
\n <\/idea\u5b89\u88c5\u8be6\u89e3><\/p>\n

\ud83d\udc494. java\u57fa\u7840\u8bed\u6cd5\ud83d\udc48<\/h2>\n

4.1 \u6ce8\u91ca\uff08\u7406\u89e3\uff09<\/h5>\n
\n

\u6ce8\u91ca\u662f\u5bf9\u4ee3\u7801\u7684\u89e3\u91ca\u548c\u8bf4\u660e\u6587\u5b57\uff0c\u53ef\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u53ef\u8bfb\u6027\uff0c\u56e0\u6b64\u5728\u7a0b\u5e8f\u4e2d\u6dfb\u52a0\u5fc5\u8981\u7684\u6ce8\u91ca\u6587\u5b57\u5341\u5206\u91cd\u8981\u3002Java\u4e2d\u7684\u6ce8\u91ca\u5206\u4e3a\u4e09\u79cd\uff1a<\/p>\n

\u5355\u884c\u6ce8\u91ca\u3002\u5355\u884c\u6ce8\u91ca\u7684\u683c\u5f0f\u662f\u4f7f\u7528\/\/\uff0c\u4ece\/\/\u5f00\u59cb\u81f3\u672c\u884c\u7ed3\u5c3e\u7684\u6587\u5b57\u5c06\u4f5c\u4e3a\u6ce8\u91ca\u6587\u5b57\u3002<\/p>\n<\/blockquote>\n

\/\/ \u8fd9\u662f\u5355\u884c\u6ce8\u91ca\u6587\u5b57<\/span>\n<\/code><\/pre>\n
\n

\u591a\u884c\u6ce8\u91ca\u3002\u591a\u884c\u6ce8\u91ca\u7684\u683c\u5f0f\u662f\u4f7f\u7528\/* \u548c *\/\u5c06\u4e00\u6bb5\u8f83\u957f\u7684\u6ce8\u91ca\u62ec\u8d77\u6765\u3002<\/p>\n<\/blockquote>\n

\/* \u8fd9\u662f\u591a\u884c\u6ce8\u91ca\u6587\u5b57 \u8fd9\u662f\u591a\u884c\u6ce8\u91ca\u6587\u5b57 \u8fd9\u662f\u591a\u884c\u6ce8\u91ca\u6587\u5b57 *\/<\/span>\n\u6ce8\u610f\uff1a\u591a\u884c\u6ce8\u91ca\u4e0d\u80fd\u5d4c\u5957\u4f7f\u7528\u3002\n<\/code><\/pre>\n
\n

\u6587\u6863\u6ce8\u91ca\u3002\u6587\u6863\u6ce8\u91ca\u4ee5\/**<\/code>\u5f00\u59cb\uff0c\u4ee5*\/<\/code>\u7ed3\u675f\u3002\uff08\u4ee5\u540e\u8bb2\uff09<\/p>\n<\/blockquote>\n

4.2 \u5b57\u9762\u91cf\uff08\u5e94\u7528\uff09<\/h5>\n
\n

\u4f5c\u7528\uff1a\u544a\u8bc9\u7a0b\u5e8f\u5458\uff0c\u6570\u636e\u5728\u7a0b\u5e8f\u4e2d\u7684\u4e66\u5199\u683c\u5f0f\u3002<\/code><\/p>\n<\/blockquote>\n\n\n\n\n\n\n\n\n\n\n
\u5b57\u9762\u91cf\u7c7b\u578b<\/strong><\/th>\n\u8bf4\u660e<\/strong><\/th>\n\u7a0b\u5e8f\u4e2d\u7684\u5199\u6cd5<\/strong><\/th>\n<\/tr>\n<\/thead>\n
\u6574\u6570<\/td>\n\u4e0d\u5e26\u5c0f\u6570\u7684\u6570\u5b57<\/td>\n666\uff0c-88<\/td>\n<\/tr>\n
\u5c0f\u6570<\/td>\n\u5e26\u5c0f\u6570\u7684\u6570\u5b57<\/td>\n13.14\uff0c-5.21<\/td>\n<\/tr>\n
\u5b57\u7b26<\/td>\n\u5fc5\u987b\u4f7f\u7528\u5355\u5f15\u53f7\uff0c\u6709\u4e14\u4ec5\u80fd\u4e00\u4e2a\u5b57\u7b26<\/td>\n\u2018A\u2019\uff0c\u20180\u2019\uff0c \u2018\u6211\u2019<\/td>\n<\/tr>\n
\u5b57\u7b26\u4e32<\/td>\n\u5fc5\u987b\u4f7f\u7528\u53cc\u5f15\u53f7\uff0c\u5185\u5bb9\u53ef\u6709\u53ef\u65e0<\/td>\n\u201cHelloWorld\u201d\uff0c\u201c\u9ed1\u9a6c\u7a0b\u5e8f\u5458\u201d<\/td>\n<\/tr>\n
\u5e03\u5c14\u503c<\/td>\n\u5e03\u5c14\u503c\uff0c\u8868\u793a\u771f\u5047\uff0c\u53ea\u6709\u4e24\u4e2a\u503c\uff1atrue\uff0cfalse<\/td>\ntrue \u3001false<\/td>\n<\/tr>\n
\u7a7a\u503c<\/td>\n\u4e00\u4e2a\u7279\u6b8a\u7684\u503c\uff0c\u7a7a\u503c<\/td>\n\u503c\u662f\uff1anull<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
public<\/span> class<\/span> Demo<\/span> { \n   <\/span>\n    public<\/span> static<\/span> void<\/span> main<\/span>(<\/span>String[<\/span>]<\/span> args)<\/span> { \n   <\/span>\n        System.<\/span>out.<\/span>println<\/span>(<\/span>10<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51fa\u4e00\u4e2a\u6574\u6570<\/span>\n        System.<\/span>out.<\/span>println<\/span>(<\/span>5.5<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51fa\u4e00\u4e2a\u5c0f\u6570<\/span>\n        System.<\/span>out.<\/span>println<\/span>(<\/span>'a'<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51fa\u4e00\u4e2a\u5b57\u7b26<\/span>\n        System.<\/span>out.<\/span>println<\/span>(<\/span>true<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51faboolean\u503ctrue<\/span>\n        System.<\/span>out.<\/span>println<\/span>(<\/span>\"\u6b22\u8fce\u6765\u5230\u9ed1\u9a6c\u7a0b\u5e8f\u5458\"<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51fa\u5b57\u7b26\u4e32<\/span>\n    }<\/span>\n}<\/span>\n<\/code><\/pre>\n
4.3 \u6570\u636e\u7c7b\u578b\uff08\u8bb0\u5fc6\u3001\u5e94\u7528\uff09<\/h5>\n
3.4.1 \u8ba1\u7b97\u673a\u5b58\u50a8\u5355\u5143<\/h6>\n
\n

l\u8ba1\u7b97\u673a\u5e95\u5c42\u90fd\u662f\u4e00\u4e9b\u6570\u5b57\u7535\u8def(\u7406\u89e3\u6210\u5f00\u5173)\uff0c\u7528\u5f00\u8868\u793a0\u3001\u5173\u8868\u793a1\uff0c\u8fd9\u4e9b01\u7684\u5f62\u5f0f\u5c31\u662f\u4e8c\u8fdb\u5236\u3002<\/p>\n

\u6570\u636e\u5728\u8ba1\u7b97\u673a\u5e95\u5c42\u90fd\u662f\u91c7\u7528\u4e8c\u8fdb\u5236\u5b58\u50a8\u7684\uff0cl\u5728\u8ba1\u7b97\u673a\u4e2d\u8ba4\u4e3a\u4e00\u4e2a\u5f00\u5173\u8868\u793a\u76840|1\u79f0\u4e3a1\u4f4d\uff08b\uff09\uff0c\u6bcf8\u4f4d\u79f0\u4e3a\u4e00\u4e2a\u5b57\u8282\uff08B\uff09\uff0c \u6240\u4ee51B=8b<\/p>\n

\u5b57\u8282\u662f\u8ba1\u7b97\u673a\u4e2d\u6570\u636e\u7684\u6700\u5c0f\u5355\u4f4d\u3002<\/p>\n

\u6211\u4eec\u77e5\u9053\u8ba1\u7b97\u673a\u662f\u53ef\u4ee5\u7528\u6765\u5b58\u50a8\u6570\u636e\u7684\uff0c\u4f46\u662f\u65e0\u8bba\u662f\u5185\u5b58\u8fd8\u662f\u786c\u76d8\uff0c\u8ba1\u7b97\u673a\u5b58\u50a8\u8bbe\u5907\u7684\u6700\u5c0f\u4fe1\u606f\u5355\u5143\u53eb\u201c\u4f4d\uff08bit\uff09\u201d\uff0c\u6211\u4eec\u53c8\u79f0\u4e4b\u4e3a\u201c\u6bd4\u7279\u4f4d\u201d\uff0c\u901a\u5e38\u7528\u5c0f\u5199\u7684\u5b57\u6bcd\u201db\u201d\u8868\u793a\u3002\u800c\u8ba1\u7b97\u673a\u4e2d\u6700\u57fa\u672c\u7684\u5b58\u50a8\u5355\u5143\u53eb\u201c\u5b57\u8282\uff08byte\uff09\u201d\uff0c<\/p>\n

\u901a\u5e38\u7528\u5927\u5199\u5b57\u6bcd\u201dB\u201d\u8868\u793a\uff0c\u5b57\u8282\u662f\u7531\u8fde\u7eed\u76848\u4e2a\u4f4d\u7ec4\u6210\u3002<\/p>\n

\u9664\u4e86\u5b57\u8282\u5916\u8fd8\u6709\u4e00\u4e9b\u5e38\u7528\u7684\u5b58\u50a8\u5355\u4f4d\uff0c\u5176\u6362\u7b97\u5355\u4f4d\u5982\u4e0b\uff1a<\/p>\n

1B\uff08\u5b57\u8282\uff09 = 8bit<\/p>\n

1KB = 1024B<\/p>\n

1MB = 1024KB<\/p>\n

1GB = 1024MB<\/p>\n

1TB = 1024GB<\/p>\n<\/blockquote>\n

3.4.2 Java\u4e2d\u7684\u6570\u636e\u7c7b\u578b<\/h6>\n
\n

Java\u662f\u4e00\u4e2a\u5f3a\u7c7b\u578b\u8bed\u8a00\uff0cJava\u4e2d\u7684\u6570\u636e\u5fc5\u987b\u660e\u786e\u6570\u636e\u7c7b\u578b\u3002\u5728Java\u4e2d\u7684\u6570\u636e\u7c7b\u578b\u5305\u62ec\u57fa\u672c\u6570\u636e\u7c7b\u578b\u548c\u5f15\u7528\u6570\u636e\u7c7b\u578b\u4e24\u79cd\u3002<\/p>\n<\/blockquote>\n

Java\u4e2d\u7684\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff1a<\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n
\u6570\u636e\u7c7b\u578b<\/th>\n\u5173\u952e\u5b57<\/th>\n\u5185\u5b58\u5360\u7528<\/th>\n\u53d6\u503c\u8303\u56f4<\/th>\n<\/tr>\n<\/thead>\n
\u6574\u6570<\/td>\nbyte<\/td>\n1<\/td>\n\u8d1f\u76842\u76847\u6b21\u65b9 ~ 2\u76847\u6b21\u65b9-1(-128~127)<\/td>\n<\/tr>\n
<\/td>\nshort<\/td>\n2<\/td>\n\u8d1f\u76842\u768415\u6b21\u65b9 ~ 2\u768415\u6b21\u65b9-1(-32768~32767)<\/td>\n<\/tr>\n
<\/td>\nint<\/td>\n4<\/td>\n\u8d1f\u76842\u768431\u6b21\u65b9 ~ 2\u768431\u6b21\u65b9-1<\/td>\n<\/tr>\n
<\/td>\nlong<\/td>\n8<\/td>\n\u8d1f\u76842\u768463\u6b21\u65b9 ~ 2\u768463\u6b21\u65b9-1<\/td>\n<\/tr>\n
\u6d6e\u70b9\u6570<\/td>\nfloat<\/td>\n4<\/td>\n1.401298e-45 ~ 3.402823e+38<\/td>\n<\/tr>\n
<\/td>\ndouble<\/td>\n8<\/td>\n4.9000000e-324 ~ 1.797693e+308<\/td>\n<\/tr>\n
\u5b57\u7b26<\/td>\nchar<\/td>\n2<\/td>\n0-65535<\/td>\n<\/tr>\n
\u5e03\u5c14<\/td>\nboolean<\/td>\n1<\/td>\ntrue\uff0cfalse<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\n

\u8bf4\u660e\uff1a<\/p>\n

\u200b e+38\u8868\u793a\u662f\u4e58\u4ee510\u768438\u6b21\u65b9\uff0c\u540c\u6837\uff0ce-45\u8868\u793a\u4e58\u4ee510\u7684\u8d1f45\u6b21\u65b9\u3002<\/p>\n

\u200b \u5728java\u4e2d\u6574\u6570\u9ed8\u8ba4\u662fint\u7c7b\u578b\uff0c\u6d6e\u70b9\u6570\u9ed8\u8ba4\u662fdouble\u7c7b\u578b\u3002<\/p>\n<\/blockquote>\n

4.4 \u53d8\u91cf\uff08\u5e94\u7528\uff09<\/h5>\n
3.5.1 \u53d8\u91cf\u7684\u5b9a\u4e49<\/h6>\n
\n

\u53d8\u91cf\uff1a\u5728\u7a0b\u5e8f\u8fd0\u884c\u8fc7\u7a0b\u4e2d\uff0c\u5176\u503c\u53ef\u4ee5\u53d1\u751f\u6539\u53d8\u7684\u91cf\u3002<\/p>\n

\u4ece\u672c\u8d28\u4e0a\u8bb2\uff0c\u53d8\u91cf\u662f\u5185\u5b58\u4e2d\u7684\u4e00\u5c0f\u5757\u533a\u57df\uff0c\u5176\u503c\u53ef\u4ee5\u5728\u4e00\u5b9a\u8303\u56f4\u5185\u53d8\u5316\u3002<\/p>\n

\u53d8\u91cf\u7684\u5b9a\u4e49\u683c\u5f0f\uff1a<\/p>\n<\/blockquote>\n

\u6570\u636e\u7c7b\u578b \u53d8\u91cf\u540d =<\/span> \u521d\u59cb\u5316\u503c;<\/span> \/\/ \u58f0\u660e\u53d8\u91cf\u5e76\u8d4b\u503c<\/span>\nint<\/span> age =<\/span> 18<\/span>;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>age)<\/span>;<\/span>\n<\/code><\/pre>\n

\u6216\u8005<\/p>\n

\/\/ \u5148\u58f0\u660e\uff0c\u540e\u8d4b\u503c\uff08\u4f7f\u7528\u524d\u8d4b\u503c\u5373\u53ef\uff09<\/span>\n\u6570\u636e\u7c7b\u578b \u53d8\u91cf\u540d;<\/span>\n\u53d8\u91cf\u540d =<\/span> \u521d\u59cb\u5316\u503c;<\/span>\ndouble<\/span> money;<\/span>\nmoney =<\/span> 55.5<\/span>;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>money)<\/span>;<\/span>\n<\/code><\/pre>\n
\u8fd8\u53ef\u4ee5\u5728\u540c\u4e00\u884c\u5b9a\u4e49\u591a\u4e2a\u540c\u4e00\u79cd\u6570\u636e\u7c7b\u578b\u7684\u53d8\u91cf\uff0c\u4e2d\u95f4\u4f7f\u7528\u9017\u53f7\u9694\u5f00\u3002\u4f46\u4e0d\u5efa\u8bae\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u964d\u4f4e\u7a0b\u5e8f\u7684\u53ef\u8bfb\u6027\u3002\n<\/code><\/pre>\n
int<\/span> a =<\/span> 10<\/span>,<\/span> b =<\/span> 20<\/span>;<\/span> \/\/ \u5b9a\u4e49int\u7c7b\u578b\u7684\u53d8\u91cfa\u548cb\uff0c\u4e2d\u95f4\u4f7f\u7528\u9017\u53f7\u9694\u5f00<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>a)<\/span>;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>b)<\/span>;<\/span>\n\nint<\/span> c,<\/span>d;<\/span> \/\/ \u58f0\u660eint\u7c7b\u578b\u7684\u53d8\u91cfc\u548cd\uff0c\u4e2d\u95f4\u4f7f\u7528\u9017\u53f7\u9694\u5f00<\/span>\nc =<\/span> 30<\/span>;<\/span>\nd =<\/span> 40<\/span>;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>c)<\/span>;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>d)<\/span>;<\/span>\n<\/code><\/pre>\n

\u53d8\u91cf\u7684\u4f7f\u7528\uff1a\u901a\u8fc7\u53d8\u91cf\u540d\u8bbf\u95ee\u5373\u53ef\u3002<\/p>\n

3.5.2 \u4f7f\u7528\u53d8\u91cf\u65f6\u7684\u6ce8\u610f\u4e8b\u9879<\/h6>\n
    \n
  1. <\/li>\n<\/ol>\n
    \n

    \u5728\u540c\u4e00\u5bf9\u82b1\u62ec\u53f7\u4e2d\uff0c\u53d8\u91cf\u540d\u4e0d\u80fd\u91cd\u590d\u3002
    2. \u53d8\u91cf\u5728\u4f7f\u7528\u4e4b\u524d\uff0c\u5fc5\u987b\u521d\u59cb\u5316\uff08\u8d4b\u503c\uff09\u3002
    3. \u5b9a\u4e49long\u7c7b\u578b\u7684\u53d8\u91cf\u65f6\uff0c\u9700\u8981\u5728\u6574\u6570\u7684\u540e\u9762\u52a0L\uff08\u5927\u5c0f\u5199\u5747\u53ef\uff0c\u5efa\u8bae\u5927\u5199\uff09\u3002\u56e0\u4e3a\u6574\u6570\u9ed8\u8ba4\u662fint\u7c7b\u578b\uff0c\u6574\u6570\u592a\u5927\u53ef\u80fd\u8d85\u51faint\u8303\u56f4\u3002
    4. \u5b9a\u4e49float\u7c7b\u578b\u7684\u53d8\u91cf\u65f6\uff0c\u9700\u8981\u5728\u5c0f\u6570\u7684\u540e\u9762\u52a0F\uff08\u5927\u5c0f\u5199\u5747\u53ef\uff0c\u5efa\u8bae\u5927\u5199\uff09\u3002\u56e0\u4e3a\u6d6e\u70b9\u6570\u7684\u9ed8\u8ba4\u7c7b\u578b\u662fdouble\uff0c double\u7684\u53d6\u503c\u8303\u56f4\u662f\u5927\u4e8efloat\u7684\uff0c\u7c7b\u578b\u4e0d\u517c\u5bb9\u3002<\/p>\n<\/blockquote>\n

    4.5 \u5173\u952e\u5b57\u3001\u6807\u5fd7\u7b26\uff08\u8bb0\u5fc6\u3001\u7406\u89e3\uff09<\/h5>\n

    \u5173\u952e\u5b57<\/strong><\/p>\n

    \n

    Java\u81ea\u5df1\u4fdd\u7559\u7684\u4e00\u4e9b\u5355\u8bcd\uff0c\u4f5c\u4e3a\u7279\u6b8a\u529f\u80fd\u7684\uff0c\u4f8b\u5982\uff1apublic\u3001class\u3001byte\u3001short\u3001int\u3001long\u3001double\u2026<\/p>\n

    \u6211\u4eec\u4e0d\u80fd\u7528\u6765\u4f5c\u4e3a\u7c7b\u540d\u6216\u8005\u662f\u53d8\u91cf\u540d\u79f0\uff0c\u5426\u5219\u62a5\u9519\u3002<\/p>\n

    \u6ce8\u610f\uff1a\u5173\u952e\u5b57\u5f88\u591a\uff0c\u4e0d\u7528\u523b\u610f\u53bb\u8bb0\u3002<\/p>\n<\/blockquote>\n\n\n\n\n\n\n\n\n\n\n\n\n\n
    abstract<\/strong><\/th>\nassert<\/strong><\/th>\nboolean<\/strong><\/th>\nbreak<\/strong><\/th>\nbyte<\/strong><\/th>\n<\/tr>\n<\/thead>\n
    case<\/strong><\/td>\ncatch<\/strong><\/td>\nchar<\/strong><\/td>\nclass<\/strong><\/td>\nconst<\/strong><\/td>\n<\/tr>\n
    continue<\/strong><\/td>\ndefault<\/strong><\/td>\ndo<\/strong><\/td>\ndouble<\/strong><\/td>\nelse<\/strong><\/td>\n<\/tr>\n
    enum<\/strong><\/td>\nextends<\/strong><\/td>\nfinal<\/strong><\/td>\nfinally<\/strong><\/td>\nfloat<\/strong><\/td>\n<\/tr>\n
    for<\/strong><\/td>\ngoto<\/strong><\/td>\nif<\/strong><\/td>\nimplements<\/strong><\/td>\nimport<\/strong><\/td>\n<\/tr>\n
    instanceof<\/strong><\/td>\nint<\/strong><\/td>\ninterface<\/strong><\/td>\nlong<\/strong><\/td>\nnative<\/strong><\/td>\n<\/tr>\n
    new<\/strong><\/td>\npackage<\/strong><\/td>\nprivate<\/strong><\/td>\nprotected<\/strong><\/td>\npublic<\/strong><\/td>\n<\/tr>\n
    return<\/strong><\/td>\nstrictfp<\/strong><\/td>\nshort<\/strong><\/td>\nstatic<\/strong><\/td>\nsuper<\/strong><\/td>\n<\/tr>\n
    switch<\/strong><\/td>\nsynchronized<\/strong><\/td>\nthis<\/strong><\/td>\nthrow<\/strong><\/td>\nthrows<\/strong><\/td>\n<\/tr>\n
    transient<\/strong><\/td>\ntry<\/strong><\/td>\nvoid<\/strong><\/td>\nvolatile<\/strong><\/td>\nwhile<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

    \u6807\u5fd7\u7b26<\/strong><\/p>\n

    \n

    \u6807\u5fd7\u7b26\u5c31\u662f\u7531\u4e00\u4e9b\u5b57\u7b26\u3001\u7b26\u53f7\u7ec4\u5408\u8d77\u6765\u7684\u540d\u79f0\uff0c\u7528\u4e8e\u7ed9\u7c7b\uff0c\u65b9\u6cd5\uff0c\u53d8\u91cf\u7b49\u8d77\u540d\u5b57\u7684\u89c4\u77e9\u3002<\/p>\n

    \u57fa\u672c\u8981\u6c42\uff1a\u7531\u6570\u5b57\u3001\u5b57\u6bcd\u3001\u4e0b\u5212\u7ebf(_)\u548c\u7f8e\u5143\u7b26($)\u7b49\u7ec4\u6210<\/p>\n

    \u5f3a\u5236\u8981\u6c42\uff1a\u4e0d\u80fd\u4ee5\u6570\u5b57\u5f00\u5934\u3001\u4e0d\u80fd\u662f\u5173\u952e\u5b57\u3001\u533a\u5206\u5927\u5c0f\u5199<\/p>\n<\/blockquote>\n

    \u57fa\u672c\u547d\u4ee4\u89c4\u8303<\/strong><\/p>\n

    \n

    \u53d8\u91cf\u540d\u79f0\uff1a\u6ee1\u8db3\u6807\u8bc6\u7b26\u89c4\u5219\uff0c\u5efa\u8bae\u5168\u82f1\u6587\u3001\u6709\u610f\u4e49\u3001\u9996\u5b57\u6bcd\u5c0f\u5199\uff0c\u6ee1\u8db3\u201c\u9a7c\u5cf0\u6a21\u5f0f\u201d\uff0c\u4f8b\u5982\uff1aint studyNumber = 59\u3002<\/p>\n

    \u7c7b\u540d\u79f0\uff1a \u6ee1\u8db3\u6807\u8bc6\u7b26\u89c4\u5219\uff0c\u5efa\u8bae\u5168\u82f1\u6587\u3001\u6709\u610f\u4e49\u3001\u9996\u5b57\u6bcd\u5927\u5199\uff0c\u6ee1\u8db3\u201c\u9a7c\u5cf0\u6a21\u5f0f\u201d\uff0c\u4f8b\u5982\uff1aHelloWorld.java\u3002<\/p>\n<\/blockquote>\n

    \ud83d\udc495.\u7c7b\u578b\u8f6c\u6362\u95ee\u9898\ud83d\udc48<\/h2>\n

    \u7c7b\u578b\u8f6c\u6362\uff08\u7406\u89e3\uff09<\/h6>\n
    \n

    \u5728Java\u4e2d\uff0c\u4f1a\u5b58\u5728\u4e0d\u540c\u7c7b\u578b\u7684\u6570\u636e\u9700\u8981\u4e00\u8d77\u53c2\u4e0e\u8fd0\u7b97\uff0c\u6240\u4ee5\u8fd9\u4e9b\u6570\u636e\u7c7b\u578b\u4e4b\u95f4\u662f\u9700\u8981\u76f8\u4e92\u8f6c\u6362\u7684\uff0c\u5206\u4e3a\u4e24\u79cd\u60c5\u51b5\uff1a\u81ea\u52a8\u7c7b\u578b\u8f6c\u6362\u548c\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u3002<\/p>\n<\/blockquote>\n

    \u81ea\u52a8\u7c7b\u578b\u8f6c\u6362<\/h6>\n
    \n

    *\u7c7b\u578b\u8303\u56f4\u5c0f\u7684\u53d8\u91cf\uff0c\u53ef\u4ee5<\/strong>\u76f4\u63a5\u8d4b\u503c\u7ed9<\/strong>\u7c7b\u578b\u8303\u56f4\u5927**\u7684\u53d8\u91cf\u3002<\/p>\n

    \u628a\u4e00\u4e2a\u8868\u793a\u6570\u636e\u8303\u56f4\u5c0f\u7684\u6570\u503c\u6216\u8005\u53d8\u91cf\u8d4b\u503c\u7ed9\u53e6\u4e00\u4e2a\u8868\u793a\u6570\u636e\u8303\u56f4\u5927\u7684\u53d8\u91cf\u3002\u8fd9\u79cd\u8f6c\u6362\u65b9\u5f0f\u662f\u81ea\u52a8\u7684\uff0c\u76f4\u63a5\u4e66\u5199\u5373\u53ef\u3002\u4f8b\u5982\uff1a<\/p>\n<\/blockquote>\n

    double<\/span> num =<\/span> 10<\/span>;<\/span> \/\/ \u5c06int\u7c7b\u578b\u768410\u76f4\u63a5\u8d4b\u503c\u7ed9double\u7c7b\u578b<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>num)<\/span>;<\/span> \/\/ \u8f93\u51fa10.0<\/span>\n\nbyte<\/span> a =<\/span> 12<\/span> ;<\/span>\nint<\/span> b =<\/span> a;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>b)<\/span>;<\/span> \/\/ 12<\/span>\n\n<\/code><\/pre>\n
    \u8868\u8fbe\u5f0f\u7684\u81ea\u52a8\u7c7b\u578b\u8f6c\u6362<\/strong><\/h6>\n
    \n

    \u5728\u8868\u8fbe\u5f0f\u4e2d\uff0c\u5c0f\u8303\u56f4\u7c7b\u578b\u7684\u53d8\u91cf\u4f1a\u81ea\u52a8\u8f6c\u6362\u6210\u5f53\u524d\u8f83\u5927\u8303\u56f4\u7684\u7c7b\u578b\u518d\u8fd0\u7b97\u3002<\/p>\n<\/blockquote>\n

    \u6ce8\u610f\u4e8b\u9879\uff1a<\/strong><\/p>\n

    \n

    \u8868\u8fbe\u5f0f\u7684\u6700\u7ec8\u7ed3\u679c\u7c7b\u578b\u7531\u8868\u8fbe\u5f0f\u4e2d\u7684\u6700\u9ad8\u7c7b\u578b\u51b3\u5b9a\u3002<\/p>\n

    \u5728\u8868\u8fbe\u5f0f\u4e2d\uff0cbyte\u3001short\u3001char \u662f\u76f4\u63a5\u8f6c\u6362\u6210int\u7c7b\u578b\u53c2\u4e0e\u8fd0\u7b97\u7684\u3002<\/p>\n<\/blockquote>\n

    \u5f3a\u5236\u7c7b\u578b\u8f6c\u6362<\/h6>\n
    \n

    \u7c7b\u578b\u8303\u56f4\u5927\u7684\u6570\u636e\u6216\u8005\u53d8\u91cf\uff0c\u4e0d\u80fd\u76f4\u63a5\u8d4b\u503c<\/strong>\u7ed9\u7c7b\u578b\u8303\u56f4\u5c0f<\/strong>\u7684\u53d8\u91cf\uff0c\u4f1a\u62a5\u9519\uff0c\u628a\u4e00\u4e2a\u8868\u793a\u6570\u636e\u8303\u56f4\u5927\u7684\u6570\u503c\u6216\u8005\u53d8\u91cf\u8d4b\u503c\u7ed9\u53e6\u4e00\u4e2a\u8868\u793a\u6570\u636e\u8303\u56f4\u5c0f\u7684\u53d8\u91cf\u5fc5\u987b\u8fdb\u884c\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u3002<\/p>\n

    \u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u683c\u5f0f\uff1a\u76ee\u6807\u6570\u636e\u7c7b\u578b \u53d8\u91cf\u540d = (\u76ee\u6807\u6570\u636e\u7c7b\u578b)\u503c\u6216\u8005\u53d8\u91cf;<\/p>\n

    \u200b \u4f8b\u5982\uff1a<\/p>\n<\/blockquote>\n

    double<\/span> num1 =<\/span> 5.5<\/span>;<\/span>\nint<\/span> num2 =<\/span> (<\/span>int<\/span>)<\/span> num1;<\/span> \/\/ \u5c06double\u7c7b\u578b\u7684num1\u5f3a\u5236\u8f6c\u6362\u4e3aint\u7c7b\u578b<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>num2)<\/span>;<\/span> \/\/ \u8f93\u51fa5\uff08\u5c0f\u6570\u4f4d\u76f4\u63a5\u820d\u5f03\uff09<\/span>\n<\/code><\/pre>\n
    \n

    \u8bf4\u660e\uff1a<\/p>\n

      \n
    1. char\u7c7b\u578b\u7684\u6570\u636e\u8f6c\u6362\u4e3aint\u7c7b\u578b\u662f\u6309\u7167\u7801\u8868\u4e2d\u5bf9\u5e94\u7684int\u503c\u8fdb\u884c\u8ba1\u7b97\u7684\u3002\u6bd4\u5982\u5728ASCII\u7801\u8868\u4e2d\uff0c'a\u2019\u5bf9\u5e9497\u3002<\/li>\n<\/ol>\n<\/blockquote>\n
      int<\/span> a =<\/span> 'a'<\/span>;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>a)<\/span>;<\/span> \/\/ \u5c06\u8f93\u51fa97<\/span>\n<\/code><\/pre>\n
        \n
      1. \u6574\u6570\u9ed8\u8ba4\u662fint\u7c7b\u578b\uff0cbyte\u3001short\u548cchar\u7c7b\u578b\u6570\u636e\u53c2\u4e0e\u8fd0\u7b97\u5747\u4f1a\u81ea\u52a8\u8f6c\u6362\u4e3aint\u7c7b\u578b\u3002<\/li>\n<\/ol>\n
        byte<\/span> b1 =<\/span> 10<\/span>;<\/span>\nbyte<\/span> b2 =<\/span> 20<\/span>;<\/span>\nbyte<\/span> b3 =<\/span> b1 +<\/span> b2;<\/span> \n\/\/ \u7b2c\u4e09\u884c\u4ee3\u7801\u4f1a\u62a5\u9519\uff0cb1\u548cb2\u4f1a\u81ea\u52a8\u8f6c\u6362\u4e3aint\u7c7b\u578b\uff0c\u8ba1\u7b97\u7ed3\u679c\u4e3aint\uff0cint\u8d4b\u503c\u7ed9byte\u9700\u8981\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u3002<\/span>\n\/\/ \u4fee\u6539\u4e3a:<\/span>\nint<\/span> num =<\/span> b1 +<\/span> b2;<\/span>\n\/\/ \u6216\u8005\uff1a<\/span>\nbyte<\/span> b3 =<\/span> (<\/span>byte<\/span>)<\/span> (<\/span>b1 +<\/span> b2)<\/span>;<\/span>\n<\/code><\/pre>\n
          \n
        1. boolean\u7c7b\u578b\u4e0d\u80fd\u4e0e\u5176\u4ed6\u57fa\u672c\u6570\u636e\u7c7b\u578b\u76f8\u4e92\u8f6c\u6362\u3002<\/li>\n<\/ol>\n

          \ud83d\udc496. \u8fd0\u7b97\u7b26\ud83d\udc48<\/h2>\n

          6.1 \u7b97\u672f\u8fd0\u7b97\u7b26\uff08\u7406\u89e3\uff09<\/h4>\n

          6.1.1 \u8fd0\u7b97\u7b26\u548c\u8868\u8fbe\u5f0f<\/h5>\n
          \n

          \u8fd0\u7b97\u7b26\uff1a\u5bf9\u5e38\u91cf\u6216\u8005\u53d8\u91cf\u8fdb\u884c\u64cd\u4f5c\u7684\u7b26\u53f7<\/p>\n

          \u8868\u8fbe\u5f0f\uff1a\u7528\u8fd0\u7b97\u7b26\u628a\u5e38\u91cf\u6216\u8005\u53d8\u91cf\u8fde\u63a5\u8d77\u6765\u7b26\u5408java\u8bed\u6cd5\u7684\u5f0f\u5b50\u5c31\u53ef\u4ee5\u79f0\u4e3a\u8868\u8fbe\u5f0f\u3002<\/p>\n

          \u200b \u4e0d\u540c\u8fd0\u7b97\u7b26\u8fde\u63a5\u7684\u8868\u8fbe\u5f0f\u4f53\u73b0\u7684\u662f\u4e0d\u540c\u7c7b\u578b\u7684\u8868\u8fbe\u5f0f\u3002<\/p>\n

          \u4e3e\u4f8b\u8bf4\u660e\uff1a<\/p>\n<\/blockquote>\n

          int<\/span> a =<\/span> 10<\/span>;<\/span>\nint<\/span> b =<\/span> 20<\/span>;<\/span>\nint<\/span> c =<\/span> a +<\/span> b;<\/span>\n<\/code><\/pre>\n
          \n

          +\uff1a\u662f\u8fd0\u7b97\u7b26\uff0c\u5e76\u4e14\u662f\u7b97\u672f\u8fd0\u7b97\u7b26\u3002<\/p>\n

          a + b\uff1a\u662f\u8868\u8fbe\u5f0f\uff0c\u7531\u4e8e+\u662f\u7b97\u672f\u8fd0\u7b97\u7b26\uff0c\u6240\u4ee5\u8fd9\u4e2a\u8868\u8fbe\u5f0f\u53eb\u7b97\u672f\u8868\u8fbe\u5f0f\u3002<\/p>\n<\/blockquote>\n

          6.1.2 \u7b97\u672f\u8fd0\u7b97\u7b26<\/h5>\n\n\n\n\n\n\n\n\n\n
          \u7b26\u53f7<\/th>\n\u4f5c\u7528<\/th>\n\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n
          +<\/td>\n\u52a0<\/td>\n\u53c2\u770b\u5c0f\u5b66\u4e00\u5e74\u7ea7<\/td>\n<\/tr>\n
          -<\/td>\n\u51cf<\/td>\n\u53c2\u770b\u5c0f\u5b66\u4e00\u5e74\u7ea7<\/td>\n<\/tr>\n
          *<\/td>\n\u4e58<\/td>\n\u53c2\u770b\u5c0f\u5b66\u4e8c\u5e74\u7ea7\uff0c\u4e0e\u201c\u00d7\u201d\u76f8\u540c<\/td>\n<\/tr>\n
          \/<\/td>\n\u9664<\/td>\n\u53c2\u770b\u5c0f\u5b66\u4e8c\u5e74\u7ea7\uff0c\u4e0e\u201c\u00f7\u201d\u76f8\u540c<\/td>\n<\/tr>\n
          %<\/td>\n\u53d6\u4f59<\/td>\n\u83b7\u53d6\u7684\u662f\u4e24\u4e2a\u6570\u636e\u505a\u9664\u6cd5\u7684\u4f59\u6570<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
          \n

          \u6ce8\u610f\uff1a<\/p>\n

          \/\u548c%\u7684\u533a\u522b\uff1a\u4e24\u4e2a\u6570\u636e\u505a\u9664\u6cd5\uff0c\/\u53d6\u7ed3\u679c\u7684\u5546\uff0c%\u53d6\u7ed3\u679c\u7684\u4f59\u6570\u3002<\/p>\n

          \u6574\u6570\u64cd\u4f5c\u53ea\u80fd\u5f97\u5230\u6574\u6570\uff0c\u8981\u60f3\u5f97\u5230\u5c0f\u6570\uff0c\u5fc5\u987b\u6709\u6d6e\u70b9\u6570\u53c2\u4e0e\u8fd0\u7b97\u3002<\/p>\n<\/blockquote>\n

          int<\/span> a =<\/span> 10<\/span>;<\/span>\nint<\/span> b =<\/span> 3<\/span>;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>a \/<\/span> b)<\/span>;<\/span> \/\/ \u8f93\u51fa\u7ed3\u679c3<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>a %<\/span> b)<\/span>;<\/span> \/\/ \u8f93\u51fa\u7ed3\u679c1<\/span>\n<\/code><\/pre>\n
          6.1.3 \u5b57\u7b26\u7684\u201c+\u201d\u64cd\u4f5c<\/h5>\n
          \n

          char\u7c7b\u578b\u53c2\u4e0e\u7b97\u672f\u8fd0\u7b97\uff0c\u4f7f\u7528\u7684\u662f\u8ba1\u7b97\u673a\u5e95\u5c42\u5bf9\u5e94\u7684\u5341\u8fdb\u5236\u6570\u503c\u3002\u9700\u8981\u6211\u4eec\u8bb0\u4f4f\u4e09\u4e2a\u5b57\u7b26\u5bf9\u5e94\u7684\u6570\u503c\uff1a<\/p>\n

          \u2018a\u2019 \u2013 97 a-z\u662f\u8fde\u7eed\u7684\uff0c\u6240\u4ee5\u2019b\u2019\u5bf9\u5e94\u7684\u6570\u503c\u662f98\uff0c'c\u2019\u662f99\uff0c\u4f9d\u6b21\u9012\u52a0<\/p>\n

          \u2018A\u2019 \u2013 65 A-Z\u662f\u8fde\u7eed\u7684\uff0c\u6240\u4ee5\u2019B\u2019\u5bf9\u5e94\u7684\u6570\u503c\u662f66\uff0c'C\u2019\u662f67\uff0c\u4f9d\u6b21\u9012\u52a0<\/p>\n

          \u20180\u2019 \u2013 48 0-9\u662f\u8fde\u7eed\u7684\uff0c\u6240\u4ee5\u20191\u2019\u5bf9\u5e94\u7684\u6570\u503c\u662f49\uff0c'2\u2019\u662f50\uff0c\u4f9d\u6b21\u9012\u52a0<\/p>\n<\/blockquote>\n

          \/\/ \u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u5b57\u7b26\u4e0e\u6574\u6570\u505a\u7b97\u672f\u8fd0\u7b97\uff0c\u5f97\u51fa\u5b57\u7b26\u5bf9\u5e94\u7684\u6570\u503c\u662f\u591a\u5c11<\/span>\nchar<\/span> ch1 =<\/span> 'a'<\/span>;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>ch1 +<\/span> 1<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51fa98\uff0c97 + 1 = 98<\/span>\n\nchar<\/span> ch2 =<\/span> 'A'<\/span>;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>ch2 +<\/span> 1<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51fa66\uff0c65 + 1 = 66<\/span>\n\nchar<\/span> ch3 =<\/span> '0'<\/span>;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>ch3 +<\/span> 1<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51fa49\uff0c48 + 1 = 49<\/span>\n<\/code><\/pre>\n
          \n

          \u7b97\u672f\u8868\u8fbe\u5f0f\u4e2d\u5305\u542b\u4e0d\u540c\u7684\u57fa\u672c\u6570\u636e\u7c7b\u578b\u7684\u503c\u7684\u65f6\u5019\uff0c\u6574\u4e2a\u7b97\u672f\u8868\u8fbe\u5f0f\u7684\u7c7b\u578b\u4f1a\u81ea\u52a8\u8fdb\u884c\u63d0\u5347\u3002<\/p>\n

          \u63d0\u5347\u89c4\u5219\uff1a<\/p>\n

          byte\u7c7b\u578b\uff0cshort\u7c7b\u578b\u548cchar\u7c7b\u578b\u5c06\u88ab\u63d0\u5347\u5230int\u7c7b\u578b\uff0c\u4e0d\u7ba1\u662f\u5426\u6709\u5176\u4ed6\u7c7b\u578b\u53c2\u4e0e\u8fd0\u7b97\u3002<\/p>\n

          \u6574\u4e2a\u8868\u8fbe\u5f0f\u7684\u7c7b\u578b\u81ea\u52a8\u63d0\u5347\u5230\u4e0e\u8868\u8fbe\u5f0f\u4e2d\u6700\u9ad8\u7b49\u7ea7\u7684\u64cd\u4f5c\u6570\u76f8\u540c\u7684\u7c7b\u578b<\/p>\n

          \u200b \u7b49\u7ea7\u987a\u5e8f\uff1abyte,short,char --> int --> long --> float --> double<\/p>\n<\/blockquote>\n

          \u4f8b\u5982\uff1a<\/p>\n

          byte<\/span> b1 =<\/span> 10<\/span>;<\/span>\nbyte<\/span> b2 =<\/span> 20<\/span>;<\/span>\n\/\/ byte b3 = b1 + b2; \/\/ \u8be5\u884c\u62a5\u9519\uff0c\u56e0\u4e3abyte\u7c7b\u578b\u53c2\u4e0e\u7b97\u672f\u8fd0\u7b97\u4f1a\u81ea\u52a8\u63d0\u793a\u4e3aint\uff0cint\u8d4b\u503c\u7ed9byte\u53ef\u80fd\u635f\u5931\u7cbe\u5ea6<\/span>\nint<\/span> i3 =<\/span> b1 +<\/span> b2;<\/span> \/\/ \u5e94\u8be5\u4f7f\u7528int\u63a5\u6536<\/span>\nbyte<\/span> b3 =<\/span> (<\/span>byte<\/span>)<\/span> (<\/span>b1 +<\/span> b2)<\/span>;<\/span> \/\/ \u6216\u8005\u5c06\u7ed3\u679c\u5f3a\u5236\u8f6c\u6362\u4e3abyte\u7c7b\u578b<\/span>\n--<\/span>--<\/span>--<\/span>--<\/span>--<\/span>--<\/span>--<\/span>--<\/span>--<\/span>--<\/span>--<\/span>--<\/span>--<\/span>--<\/span>--<\/span>-<\/span>\nint<\/span> num1 =<\/span> 10<\/span>;<\/span>\ndouble<\/span> num2 =<\/span> 20.0<\/span>;<\/span>\ndouble<\/span> num3 =<\/span> num1 +<\/span> num2;<\/span> \/\/ \u4f7f\u7528double\u63a5\u6536\uff0c\u56e0\u4e3anum1\u4f1a\u81ea\u52a8\u63d0\u5347\u4e3adouble\u7c7b\u578b<\/span>\n<\/code><\/pre>\n
          \n

          tips\uff1a\u6b63\u662f\u7531\u4e8e\u4e0a\u8ff0\u539f\u56e0\uff0c\u6240\u4ee5\u5728\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u6211\u4eec\u5f88\u5c11\u4f7f\u7528byte\u6216\u8005short\u7c7b\u578b\u5b9a\u4e49\u6574\u6570\u3002\u4e5f\u5f88\u5c11\u4f1a\u4f7f\u7528char\u7c7b\u578b\u5b9a\u4e49\u5b57\u7b26\uff0c\u800c\u4f7f\u7528\u5b57\u7b26\u4e32\u7c7b\u578b\uff0c\u66f4\u4e0d\u4f1a\u4f7f\u7528char\u7c7b\u578b\u505a\u7b97\u672f\u8fd0\u7b97\u3002<\/p>\n<\/blockquote>\n

          6.1.4 \u5b57\u7b26\u4e32\u7684\u201c+\u201d\u64cd\u4f5c<\/h5>\n

          \u5f53\u201c+\u201d\u64cd\u4f5c\u4e2d\u51fa\u73b0\u5b57\u7b26\u4e32\u65f6\uff0c\u8fd9\u4e2a\u201d+\u201d\u662f\u5b57\u7b26\u4e32\u8fde\u63a5\u7b26\uff0c\u800c\u4e0d\u662f\u7b97\u672f\u8fd0\u7b97\u3002<\/p>\n

          System.<\/span>out.<\/span>println<\/span>(<\/span>\"heihei\"<\/span>+<\/span> 666<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51fa\uff1aheihei666<\/span>\n<\/code><\/pre>\n

          \u5728\u201d+\u201d\u64cd\u4f5c\u4e2d\uff0c\u5982\u679c\u51fa\u73b0\u4e86\u5b57\u7b26\u4e32\uff0c\u5c31\u662f\u8fde\u63a5\u8fd0\u7b97\u7b26\uff0c\u5426\u5219\u5c31\u662f\u7b97\u672f\u8fd0\u7b97\u3002\u5f53\u8fde\u7eed\u8fdb\u884c\u201c+\u201d\u64cd\u4f5c\u65f6\uff0c\u4ece\u5de6\u5230\u53f3\u9010\u4e2a\u6267\u884c\u3002<\/p>\n

          System.<\/span>out.<\/span>println<\/span>(<\/span>1<\/span> +<\/span> 99<\/span> +<\/span> \"\u5e74\"<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51fa\uff1a199\u5e74<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>1<\/span> +<\/span> 2<\/span> +<\/span> \"hahaha\"<\/span> +<\/span> 3<\/span> +<\/span> 4<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51fa\uff1a3hahah34<\/span>\n\/\/ \u53ef\u4ee5\u4f7f\u7528\u5c0f\u62ec\u53f7\u6539\u53d8\u8fd0\u7b97\u7684\u4f18\u5148\u7ea7 <\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>1<\/span> +<\/span> 2<\/span> +<\/span> \"heiheihei\"<\/span> +<\/span> (<\/span>3<\/span> +<\/span> 4<\/span>)<\/span>)<\/span>;<\/span> \/\/ \u8f93\u51fa\uff1a3heiheihei7<\/span>\n<\/code><\/pre>\n

          6.2 \u8d4b\u503c\u8fd0\u7b97\u7b26\uff08\u5e94\u7528\uff09<\/h4>\n
          \n

          \u8d4b\u503c\u8fd0\u7b97\u7b26\u7684\u4f5c\u7528\u662f\u5c06\u4e00\u4e2a\u8868\u8fbe\u5f0f\u7684\u503c\u8d4b\u7ed9\u5de6\u8fb9\uff0c\u5de6\u8fb9\u5fc5\u987b\u662f\u53ef\u4fee\u6539\u7684\uff0c\u4e0d\u80fd\u662f\u5e38\u91cf\u3002<\/p>\n<\/blockquote>\n\n\n\n\n\n\n\n\n\n\n
          \u7b26\u53f7<\/th>\n\u4f5c\u7528<\/th>\n\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n
          =<\/td>\n\u8d4b\u503c<\/td>\na=10\uff0c\u5c0610\u8d4b\u503c\u7ed9\u53d8\u91cfa<\/td>\n<\/tr>\n
          +=<\/td>\n\u52a0\u540e\u8d4b\u503c<\/td>\na+=b\uff0c\u5c06a+b\u7684\u503c\u7ed9a<\/td>\n<\/tr>\n
          -=<\/td>\n\u51cf\u540e\u8d4b\u503c<\/td>\na-=b\uff0c\u5c06a-b\u7684\u503c\u7ed9a<\/td>\n<\/tr>\n
          *=<\/td>\n\u4e58\u540e\u8d4b\u503c<\/td>\na*=b\uff0c\u5c06a\u00d7b\u7684\u503c\u7ed9a<\/td>\n<\/tr>\n
          \/=<\/td>\n\u9664\u540e\u8d4b\u503c<\/td>\na\/=b\uff0c\u5c06a\u00f7b\u7684\u5546\u7ed9a<\/td>\n<\/tr>\n
          %=<\/td>\n\u53d6\u4f59\u540e\u8d4b\u503c<\/td>\na%=b\uff0c\u5c06a\u00f7b\u7684\u4f59\u6570\u7ed9a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

          \u6ce8\u610f\uff1a<\/p>\n

          \u6269\u5c55\u7684\u8d4b\u503c\u8fd0\u7b97\u7b26\u9690\u542b\u4e86\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u3002<\/p>\n

          short<\/span> s =<\/span> 10<\/span>;<\/span>\ns =<\/span> s +<\/span> 10<\/span>;<\/span> \/\/ \u6b64\u884c\u4ee3\u7801\u62a5\u51fa\uff0c\u56e0\u4e3a\u8fd0\u7b97\u4e2ds\u63d0\u5347\u4e3aint\u7c7b\u578b\uff0c\u8fd0\u7b97\u7ed3\u679cint\u8d4b\u503c\u7ed9short\u53ef\u80fd\u635f\u5931\u7cbe\u5ea6<\/span>\n\ns +=<\/span> 10<\/span>;<\/span> \/\/ \u6b64\u884c\u4ee3\u7801\u6ca1\u6709\u95ee\u9898\uff0c\u9690\u542b\u4e86\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\uff0c\u76f8\u5f53\u4e8e s = (short) (s + 10);<\/span>\n<\/code><\/pre>\n

          6.3 \u81ea\u589e\u81ea\u51cf\u8fd0\u7b97\u7b26\uff08\u7406\u89e3\uff09<\/h4>\n\n\n\n\n\n\n
          \u7b26\u53f7<\/th>\n\u4f5c\u7528<\/th>\n\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n
          ++<\/td>\n\u81ea\u589e<\/td>\n\u53d8\u91cf\u7684\u503c\u52a01<\/td>\n<\/tr>\n
          \u2013<\/td>\n\u81ea\u51cf<\/td>\n\u53d8\u91cf\u7684\u503c\u51cf1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
          \n

          \u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n

          \u200b ++\u548c-- \u65e2\u53ef\u4ee5\u653e\u5728\u53d8\u91cf\u7684\u540e\u8fb9\uff0c\u4e5f\u53ef\u4ee5\u653e\u5728\u53d8\u91cf\u7684\u524d\u8fb9\u3002<\/p>\n

          \u200b \u5355\u72ec\u4f7f\u7528\u7684\u65f6\u5019\uff0c ++\u548c-- \u65e0\u8bba\u662f\u653e\u5728\u53d8\u91cf\u7684\u524d\u8fb9\u8fd8\u662f\u540e\u8fb9\uff0c\u7ed3\u679c\u662f\u4e00\u6837\u7684\u3002<\/p>\n

          \u200b \u53c2\u4e0e\u64cd\u4f5c\u7684\u65f6\u5019\uff0c\u5982\u679c\u653e\u5728\u53d8\u91cf\u7684\u540e\u8fb9\uff0c\u5148\u62ff\u53d8\u91cf\u53c2\u4e0e\u64cd\u4f5c\uff0c\u540e\u62ff\u53d8\u91cf\u505a++\u6216\u8005\u2013\u3002<\/p>\n

          \u200b \u53c2\u4e0e\u64cd\u4f5c\u7684\u65f6\u5019\uff0c\u5982\u679c\u653e\u5728\u53d8\u91cf\u7684\u524d\u8fb9\uff0c\u5148\u62ff\u53d8\u91cf\u505a++\u6216\u8005\u2013\uff0c\u540e\u62ff\u53d8\u91cf\u53c2\u4e0e\u64cd\u4f5c\u3002<\/p>\n

          \u200b \u6700\u5e38\u89c1\u7684\u7528\u6cd5\uff1a\u5355\u72ec\u4f7f\u7528\u3002<\/p>\n<\/blockquote>\n

          int<\/span> i =<\/span> 10<\/span>;<\/span>\ni++<\/span>;<\/span> \/\/ \u5355\u72ec\u4f7f\u7528<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>\"i:\"<\/span> +<\/span> i)<\/span>;<\/span> \/\/ i:11<\/span>\n\nint<\/span> j =<\/span> 10<\/span>;<\/span>\n++<\/span>j;<\/span> \/\/ \u5355\u72ec\u4f7f\u7528<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>\"j:\"<\/span> +<\/span> j)<\/span>;<\/span> \/\/ j:11<\/span>\n\nint<\/span> x =<\/span> 10<\/span>;<\/span>\nint<\/span> y =<\/span> x++<\/span>;<\/span> \/\/ \u8d4b\u503c\u8fd0\u7b97\uff0c++\u5728\u540e\u8fb9\uff0c\u6240\u4ee5\u662f\u4f7f\u7528x\u539f\u6765\u7684\u503c\u8d4b\u503c\u7ed9y\uff0cx\u672c\u8eab\u81ea\u589e1<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>\"x:\"<\/span> +<\/span> x +<\/span> \", y:\"<\/span> +<\/span> y)<\/span>;<\/span> \/\/ x:11\uff0cy:10<\/span>\n\nint<\/span> m =<\/span> 10<\/span>;<\/span>\nint<\/span> n =<\/span> ++<\/span>m;<\/span> \/\/ \u8d4b\u503c\u8fd0\u7b97\uff0c++\u5728\u524d\u8fb9\uff0c\u6240\u4ee5\u662f\u4f7f\u7528m\u81ea\u589e\u540e\u7684\u503c\u8d4b\u503c\u7ed9n\uff0cm\u672c\u8eab\u81ea\u589e1<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>\"m:\"<\/span> +<\/span> m +<\/span> \", m:\"<\/span> +<\/span> m)<\/span>;<\/span> \/\/ m:11\uff0cm:11<\/span>\n<\/code><\/pre>\n

          \u7ec3\u4e60\uff1a<\/p>\n

          \"Java\u5165\u95e8\u4e4b~Java\u57fa\u7840\u8bed\u6cd5<\/p>\n

          6.4 \u5173\u7cfb\u8fd0\u7b97\u7b26\uff08\u5e94\u7528\uff09<\/h4>\n

          \u5173\u7cfb\u8fd0\u7b97\u7b26\u67096\u79cd\u5173\u7cfb\uff0c\u5206\u522b\u4e3a\u5c0f\u4e8e\u3001\u5c0f\u4e8e\u7b49\u4e8e\u3001\u5927\u4e8e\u3001\u7b49\u4e8e\u3001\u5927\u4e8e\u7b49\u4e8e\u3001\u4e0d\u7b49\u4e8e\u3002<\/p>\n\n\n\n\n\n\n\n\n\n\n
          \u7b26\u53f7<\/th>\n\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n
          ==<\/td>\na==b\uff0c\u5224\u65ada\u548cb\u7684\u503c\u662f\u5426\u76f8\u7b49\uff0c\u6210\u7acb\u4e3atrue\uff0c\u4e0d\u6210\u7acb\u4e3afalse<\/td>\n<\/tr>\n
          !=<\/td>\na!=b\uff0c\u5224\u65ada\u548cb\u7684\u503c\u662f\u5426\u4e0d\u76f8\u7b49\uff0c\u6210\u7acb\u4e3atrue\uff0c\u4e0d\u6210\u7acb\u4e3afalse<\/td>\n<\/tr>\n
          ><\/td>\na>b\uff0c\u5224\u65ada\u662f\u5426\u5927\u4e8eb\uff0c\u6210\u7acb\u4e3atrue\uff0c\u4e0d\u6210\u7acb\u4e3afalse<\/td>\n<\/tr>\n
          >=<\/td>\na>=b\uff0c\u5224\u65ada\u662f\u5426\u5927\u4e8e\u7b49\u4e8eb\uff0c\u6210\u7acb\u4e3atrue\uff0c\u4e0d\u6210\u7acb\u4e3afalse<\/td>\n<\/tr>\n
          <<\/td>\na<b\uff0c\u5224\u65ada\u662f\u5426\u5c0f\u4e8eb\uff0c\u6210\u7acb\u4e3atrue\uff0c\u4e0d\u6210\u7acb\u4e3afalse<\/td>\n<\/tr>\n
          <=<\/td>\na<=b\uff0c\u5224\u65ada\u662f\u5426\u5c0f\u4e8e\u7b49\u4e8eb\uff0c\u6210\u7acb\u4e3atrue\uff0c\u4e0d\u6210\u7acb\u4e3afalse<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
          \n

          \u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n

          \u200b \u5173\u7cfb\u8fd0\u7b97\u7b26\u7684\u7ed3\u679c\u90fd\u662fboolean\u7c7b\u578b\uff0c\u8981\u4e48\u662ftrue\uff0c\u8981\u4e48\u662ffalse\u3002<\/p>\n

          \u200b \u5343\u4e07\u4e0d\u8981\u628a\u201c\u201d\u8bef\u5199\u6210\u201c=\u201d\uff0c\"<\/mark>\u201c\u662f\u5224\u65ad\u662f\u5426\u76f8\u7b49\u7684\u5173\u7cfb\uff0c\u201d=\"\u662f\u8d4b\u503c\u3002<\/p>\n<\/blockquote>\n

          int<\/span> a =<\/span> 10<\/span>;<\/span>\nint<\/span> b =<\/span> 20<\/span>;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>a ==<\/span> b)<\/span>;<\/span> \/\/ false<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>a !=<\/span> b)<\/span>;<\/span> \/\/ true<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>a ><\/span> b)<\/span>;<\/span> \/\/ false<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>a >=<\/span> b)<\/span>;<\/span> \/\/ false<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>a <<\/span> b)<\/span>;<\/span> \/\/ true<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>a <=<\/span> b)<\/span>;<\/span> \/\/ true<\/span>\n\n\/\/ \u5173\u7cfb\u8fd0\u7b97\u7684\u7ed3\u679c\u80af\u5b9a\u662fboolean\u7c7b\u578b\uff0c\u6240\u4ee5\u4e5f\u53ef\u4ee5\u5c06\u8fd0\u7b97\u7ed3\u679c\u8d4b\u503c\u7ed9boolean\u7c7b\u578b\u7684\u53d8\u91cf<\/span>\nboolean<\/span> flag =<\/span> a ><\/span> b;<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>flag)<\/span>;<\/span> \/\/ \u8f93\u51fafalse<\/span>\n<\/code><\/pre>\n

          6.5 \u903b\u8f91\u8fd0\u7b97\u7b26\uff08\u5e94\u7528\uff09<\/h4>\n

          \u903b\u8f91\u8fd0\u7b97\u7b26\u628a\u5404\u4e2a\u8fd0\u7b97\u7684\u5173\u7cfb\u8868\u8fbe\u5f0f\u8fde\u63a5\u8d77\u6765\u7ec4\u6210\u4e00\u4e2a\u590d\u6742\u7684\u903b\u8f91\u8868\u8fbe\u5f0f\uff0c\u4ee5\u5224\u65ad\u7a0b\u5e8f\u4e2d\u7684\u8868\u8fbe\u5f0f\u662f\u5426\u6210\u7acb\uff0c\u5224\u65ad\u7684\u7ed3\u679c\u662f true \u6216 false\u3002<\/p>\n\n\n\n\n\n\n\n\n
          \u7b26\u53f7<\/th>\n\u4f5c\u7528<\/th>\n\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n
          &<\/td>\n\u903b\u8f91\u4e0e<\/td>\na&b\uff0ca\u548cb\u90fd\u662ftrue\uff0c\u7ed3\u679c\u4e3atrue\uff0c\u5426\u5219\u4e3afalse<\/td>\n<\/tr>\n
          |<\/td>\n\u903b\u8f91\u6216<\/td>\na|b\uff0ca\u548cb\u90fd\u662ffalse\uff0c\u7ed3\u679c\u4e3afalse\uff0c\u5426\u5219\u4e3atrue<\/td>\n<\/tr>\n
          ^<\/td>\n\u903b\u8f91\u5f02\u6216<\/td>\na^b\uff0ca\u548cb\u7ed3\u679c\u4e0d\u540c\u4e3atrue\uff0c\u76f8\u540c\u4e3afalse<\/td>\n<\/tr>\n
          !<\/td>\n\u903b\u8f91\u975e<\/td>\n!a\uff0c\u7ed3\u679c\u548ca\u7684\u7ed3\u679c\u6b63\u597d\u76f8\u53cd<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
          \/\/\u5b9a\u4e49\u53d8\u91cf<\/span>\nint<\/span> i =<\/span> 10<\/span>;<\/span>\nint<\/span> j =<\/span> 20<\/span>;<\/span>\nint<\/span> k =<\/span> 30<\/span>;<\/span>\n\n\/\/& \u201c\u4e0e\u201d\uff0c\u5e76\u4e14\u7684\u5173\u7cfb\uff0c\u53ea\u8981\u8868\u8fbe\u5f0f\u4e2d\u6709\u4e00\u4e2a\u503c\u4e3afalse\uff0c\u7ed3\u679c\u5373\u4e3afalse<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i ><\/span> j)<\/span> &<\/span> (<\/span>i ><\/span> k)<\/span>)<\/span>;<\/span> \/\/false & false,\u8f93\u51fafalse<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i <<\/span> j)<\/span> &<\/span> (<\/span>i ><\/span> k)<\/span>)<\/span>;<\/span> \/\/true & false,\u8f93\u51fafalse<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i ><\/span> j)<\/span> &<\/span> (<\/span>i <<\/span> k)<\/span>)<\/span>;<\/span> \/\/false & true,\u8f93\u51fafalse<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i <<\/span> j)<\/span> &<\/span> (<\/span>i <<\/span> k)<\/span>)<\/span>;<\/span> \/\/true & true,\u8f93\u51fatrue<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>\"--------\"<\/span>)<\/span>;<\/span>\n\n\/\/| \u201c\u6216\u201d\uff0c\u6216\u8005\u7684\u5173\u7cfb\uff0c\u53ea\u8981\u8868\u8fbe\u5f0f\u4e2d\u6709\u4e00\u4e2a\u503c\u4e3atrue\uff0c\u7ed3\u679c\u5373\u4e3atrue<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i ><\/span> j)<\/span> |<\/span> (<\/span>i ><\/span> k)<\/span>)<\/span>;<\/span> \/\/false | false,\u8f93\u51fafalse<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i <<\/span> j)<\/span> |<\/span> (<\/span>i ><\/span> k)<\/span>)<\/span>;<\/span> \/\/true | false,\u8f93\u51fatrue<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i ><\/span> j)<\/span> |<\/span> (<\/span>i <<\/span> k)<\/span>)<\/span>;<\/span> \/\/false | true,\u8f93\u51fatrue<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i <<\/span> j)<\/span> |<\/span> (<\/span>i <<\/span> k)<\/span>)<\/span>;<\/span> \/\/true | true,\u8f93\u51fatrue<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>\"--------\"<\/span>)<\/span>;<\/span>\n\n\/\/^ \u201c\u5f02\u6216\u201d\uff0c\u76f8\u540c\u4e3afalse\uff0c\u4e0d\u540c\u4e3atrue<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i ><\/span> j)<\/span> ^<\/span> (<\/span>i ><\/span> k)<\/span>)<\/span>;<\/span> \/\/false ^ false,\u8f93\u51fafalse<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i <<\/span> j)<\/span> ^<\/span> (<\/span>i ><\/span> k)<\/span>)<\/span>;<\/span> \/\/true ^ false,\u8f93\u51fatrue<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i ><\/span> j)<\/span> ^<\/span> (<\/span>i <<\/span> k)<\/span>)<\/span>;<\/span> \/\/false ^ true,\u8f93\u51fatrue<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i <<\/span> j)<\/span> ^<\/span> (<\/span>i <<\/span> k)<\/span>)<\/span>;<\/span> \/\/true ^ true,\u8f93\u51fafalse<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>\"--------\"<\/span>)<\/span>;<\/span>\n\n\/\/! \u201c\u975e\u201d\uff0c\u53d6\u53cd<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>(<\/span>i ><\/span> j)<\/span>)<\/span>;<\/span> \/\/false<\/span>\nSystem.<\/span>out.<\/span>println<\/span>(<\/span>!<\/span>(<\/span>i ><\/span> j)<\/span>)<\/span>;<\/span> \/\/!false\uff0c,\u8f93\u51fatrue<\/span>\n<\/code><\/pre>\n
          \u77ed\u8def\u903b\u8f91\u8fd0\u7b97\u7b26<\/h5>\n\n\n\n\n\n\n
          \u7b26\u53f7<\/th>\n\u4f5c\u7528<\/th>\n\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n
          &&<\/td>\n\u77ed\u8def\u4e0e<\/td>\n\u4f5c\u7528\u548c&\u76f8\u540c\uff0c\u4f46\u662f\u6709\u77ed\u8def\u6548\u679c<\/td>\n<\/tr>\n
          ||<\/td>\n\u77ed\u8def\u6216<\/td>\n\u4f5c\u7528\u548c|\u76f8\u540c\uff0c\u4f46\u662f\u6709\u77ed\u8def\u6548\u679c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
          \n

          \u5728\u903b\u8f91\u4e0e\u8fd0\u7b97\u4e2d\uff0c\u53ea\u8981\u6709\u4e00\u4e2a\u8868\u8fbe\u5f0f\u7684\u503c\u4e3afalse\uff0c\u90a3\u4e48\u7ed3\u679c\u5c31\u53ef\u4ee5\u5224\u5b9a\u4e3afalse\u4e86\uff0c\u6ca1\u6709\u5fc5\u8981\u5c06\u6240\u6709\u8868\u8fbe\u5f0f\u7684\u503c\u90fd\u8ba1\u7b97\u51fa\u6765\uff0c\u77ed\u8def\u4e0e\u64cd\u4f5c\u5c31\u6709\u8fd9\u6837\u7684\u6548\u679c\uff0c\u53ef\u4ee5\u63d0\u9ad8\u6548\u7387\u3002\u540c\u7406\u5728\u903b\u8f91\u6216\u8fd0\u7b97\u4e2d\uff0c\u4e00\u65e6\u53d1\u73b0\u503c\u4e3atrue\uff0c\u53f3\u8fb9\u7684\u8868\u8fbe\u5f0f\u5c06\u4e0d\u518d\u53c2\u4e0e\u8fd0\u7b97\u3002<\/p>\n

            \n
          • \n

            \u903b\u8f91\u4e0e&\uff0c\u65e0\u8bba\u5de6\u8fb9\u771f\u5047\uff0c\u53f3\u8fb9\u90fd\u8981\u6267\u884c\u3002<\/p>\n<\/li>\n

          • \n

            \u77ed\u8def\u4e0e&&\uff0c\u5982\u679c\u5de6\u8fb9\u4e3a\u771f\uff0c\u53f3\u8fb9\u6267\u884c\uff1b\u5982\u679c\u5de6\u8fb9\u4e3a\u5047\uff0c\u53f3\u8fb9\u4e0d\u6267\u884c\u3002<\/p>\n<\/li>\n

          • \n

            \u903b\u8f91\u6216|\uff0c\u65e0\u8bba\u5de6\u8fb9\u771f\u5047\uff0c\u53f3\u8fb9\u90fd\u8981\u6267\u884c\u3002<\/p>\n<\/li>\n

          • \n

            \u77ed\u8def\u6216||\uff0c\u5982\u679c\u5de6\u8fb9\u4e3a\u5047\uff0c\u53f3\u8fb9\u6267\u884c\uff1b\u5982\u679c\u5de6\u8fb9\u4e3a\u771f\uff0c\u53f3\u8fb9\u4e0d\u6267\u884c\u3002<\/p>\n<\/li>\n<\/ul>\n<\/blockquote>\n

            \"Java\u5165\u95e8\u4e4b~Java\u57fa\u7840\u8bed\u6cd5<\/p>\n

            6.6 \u4e09\u5143\u8fd0\u7b97\u7b26\uff08\u7406\u89e3\uff09<\/h4>\n

            \u4e09\u5143\u8fd0\u7b97\u7b26\u8bed\u6cd5\u683c\u5f0f\uff1a<\/p>\n

            \u5173\u7cfb\u8868\u8fbe\u5f0f ?<\/span> \u8868\u8fbe\u5f0f1<\/span> :<\/span> \u8868\u8fbe\u5f0f2<\/span>;<\/span>\n<\/code><\/pre>\n
            \n

            \u89e3\u91ca\uff1a\u95ee\u53f7\u524d\u9762\u7684\u4f4d\u7f6e\u662f\u5224\u65ad\u7684\u6761\u4ef6\uff0c\u5224\u65ad\u7ed3\u679c\u4e3aboolean\u578b\uff0c\u4e3atrue\u65f6\u8c03\u7528\u8868\u8fbe\u5f0f1\uff0c\u4e3afalse\u65f6\u8c03\u7528\u8868\u8fbe\u5f0f2\u3002\u5176\u903b\u8f91\u4e3a\uff1a\u5982\u679c\u6761\u4ef6\u8868\u8fbe\u5f0f\u6210\u7acb\u6216\u8005\u6ee1\u8db3\u5219\u6267\u884c\u8868\u8fbe\u5f0f1\uff0c\u5426\u5219\u6267\u884c\u7b2c\u4e8c\u4e2a\u3002<\/p>\n<\/blockquote>\n

            \u4e3e\u4f8b\uff1a<\/p>\n

            int<\/span> a =<\/span> 10<\/span>;<\/span>\nint<\/span> b =<\/span> 20<\/span>;<\/span>\nint<\/span> c =<\/span> a ><\/span> b ?<\/span> a :<\/span> b;<\/span> \/\/ \u5224\u65ad a>b \u662f\u5426\u4e3a\u771f\uff0c\u5982\u679c\u4e3a\u771f\u53d6a\u7684\u503c\uff0c\u5982\u679c\u4e3a\u5047\uff0c\u53d6b\u7684\u503c<\/span>\n<\/code><\/pre>\n
            \n

            \u4e09\u5143\u8fd0\u7b97\u7b26\u6848\u4f8b\uff1a<\/p>\n

            1\u3001\u9700\u6c42\uff1a\u52a8\u7269\u56ed\u91cc\u6709\u4e24\u53ea\u8001\u864e\uff0c\u5df2\u77e5\u4e24\u53ea\u8001\u864e\u7684\u4f53\u91cd\u5206\u522b\u4e3a180kg\u3001200kg\uff0c\u8bf7\u7528\u7a0b\u5e8f\u5b9e\u73b0\u5224\u65ad\u4e24\u53ea\u8001\u864e\u7684\u4f53\u91cd\u662f\u5426\u76f8\u540c\u3002<\/p>\n<\/blockquote>\n

            public<\/span> class<\/span> OperatorTest01<\/span> { \n   <\/span>\n\tpublic<\/span> static<\/span> void<\/span> main<\/span>(<\/span>String[<\/span>]<\/span> args)<\/span> { \n   <\/span>\n\t\t\/\/1\uff1a\u5b9a\u4e49\u4e24\u4e2a\u53d8\u91cf\u7528\u4e8e\u4fdd\u5b58\u8001\u864e\u7684\u4f53\u91cd\uff0c\u5355\u4f4d\u4e3akg\uff0c\u8fd9\u91cc\u4ec5\u4ec5\u4f53\u73b0\u6570\u503c\u5373\u53ef\u3002<\/span>\n\t\tint<\/span> weight1 =<\/span> 180<\/span>;<\/span>\n\t\tint<\/span> weight2 =<\/span> 200<\/span>;<\/span>\t\n\t\t\/\/2\uff1a\u7528\u4e09\u5143\u8fd0\u7b97\u7b26\u5b9e\u73b0\u8001\u864e\u4f53\u91cd\u7684\u5224\u65ad\uff0c\u4f53\u91cd\u76f8\u540c\uff0c\u8fd4\u56detrue\uff0c\u5426\u5219\uff0c\u8fd4\u56defalse\u3002<\/span>\n\t\tboolean<\/span> b =<\/span> weight1 ==<\/span> weight2 ?<\/span> true<\/span> :<\/span> false<\/span>;<\/span>\t\n\t\t\/\/3\uff1a\u8f93\u51fa\u7ed3\u679c<\/span>\n\t\tSystem.<\/span>out.<\/span>println<\/span>(<\/span>\"b:\"<\/span> +<\/span> b)<\/span>;<\/span>\n\t}<\/span>\n}<\/span>\n<\/code><\/pre>\n
            \n

            2\u3001\u9700\u6c42\uff1a\u4e00\u5ea7\u5bfa\u5e99\u91cc\u4f4f\u7740\u4e09\u4e2a\u548c\u5c1a\uff0c\u5df2\u77e5\u4ed6\u4eec\u7684\u8eab\u9ad8\u5206\u522b\u4e3a150cm\u3001210cm\u3001165cm\uff0c\u8bf7\u7528\u7a0b\u5e8f\u5b9e\u73b0\u83b7\u53d6\u8fd9\u4e09\u4e2a\u548c\u5c1a\u7684\u6700\u9ad8\u8eab\u9ad8\u3002<\/p>\n<\/blockquote>\n

            public<\/span> class<\/span> OperatorTest02<\/span> { \n   <\/span>\n\tpublic<\/span> static<\/span> void<\/span> main<\/span>(<\/span>String[<\/span>]<\/span> args)<\/span> { \n   <\/span>\n\t\t\/\/1\uff1a\u5b9a\u4e49\u4e09\u4e2a\u53d8\u91cf\u7528\u4e8e\u4fdd\u5b58\u548c\u5c1a\u7684\u8eab\u9ad8\uff0c\u5355\u4f4d\u4e3acm\uff0c\u8fd9\u91cc\u4ec5\u4ec5\u4f53\u73b0\u6570\u503c\u5373\u53ef\u3002<\/span>\n\t\tint<\/span> height1 =<\/span> 150<\/span>;<\/span>\n\t\tint<\/span> height2 =<\/span> 210<\/span>;<\/span>\n\t\tint<\/span> height3 =<\/span> 165<\/span>;<\/span>\t\n\t\t\/\/2\uff1a\u7528\u4e09\u5143\u8fd0\u7b97\u7b26\u83b7\u53d6\u524d\u4e24\u4e2a\u548c\u5c1a\u7684\u8f83\u9ad8\u8eab\u9ad8\u503c\uff0c\u5e76\u7528\u4e34\u65f6\u8eab\u9ad8\u53d8\u91cf\u4fdd\u5b58\u8d77\u6765\u3002<\/span>\n\t\tint<\/span> tempHeight =<\/span> height1 ><\/span> height2 ?<\/span> height1 :<\/span> height2;<\/span>\t\t\n\t\t\/\/3\uff1a\u7528\u4e09\u5143\u8fd0\u7b97\u7b26\u83b7\u53d6\u4e34\u65f6\u8eab\u9ad8\u503c\u548c\u7b2c\u4e09\u4e2a\u548c\u5c1a\u8eab\u9ad8\u8f83\u9ad8\u503c\uff0c\u5e76\u7528\u6700\u5927\u8eab\u9ad8\u53d8\u91cf\u4fdd\u5b58\u3002<\/span>\n\t\tint<\/span> maxHeight =<\/span> tempHeight ><\/span> height3 ?<\/span> tempHeight :<\/span> height3;<\/span>\t\n\t\t\/\/4\uff1a\u8f93\u51fa\u7ed3\u679c<\/span>\n\t\tSystem.<\/span>out.<\/span>println<\/span>(<\/span>\"maxHeight:\"<\/span> +<\/span> maxHeight)<\/span>;<\/span>\n\t}<\/span>\n}<\/span>\n<\/code><\/pre>\n

            \ud83d\udc497. \u6570\u636e\u8f93\u5165\uff08\u5e94\u7528\uff09\ud83d\udc48<\/h2>\n
            \n

            \u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 Scanner \u7c7b\u6765\u83b7\u53d6\u7528\u6237\u7684\u8f93\u5165\u3002\u4f7f\u7528\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/blockquote>\n

            1\u3001\u5bfc\u5305\u3002Scanner \u7c7b\u5728java.util\u5305\u4e0b\uff0c\u6240\u4ee5\u9700\u8981\u5c06\u8be5\u7c7b\u5bfc\u5165\u3002\u5bfc\u5305\u7684\u8bed\u53e5\u9700\u8981\u5b9a\u4e49\u5728\u7c7b\u7684\u4e0a\u9762\u3002<\/h6>\n
            import<\/span> java.<\/span>util.<\/span>Scanner;<\/span> \n<\/code><\/pre>\n
            2\u3001\u521b\u5efaScanner\u5bf9\u8c61\u3002<\/h6>\n
            Scanner sc =<\/span> new<\/span> Scanner<\/span>(<\/span>System.<\/span>in)<\/span>;<\/span>\/\/ \u521b\u5efaScanner\u5bf9\u8c61\uff0csc\u8868\u793a\u53d8\u91cf\u540d\uff0c\u5176\u4ed6\u5747\u4e0d\u53ef\u53d8<\/span>\n<\/code><\/pre>\n
            3\u3001\u63a5\u6536\u6570\u636e<\/h6>\n
            int<\/span> i =<\/span> sc.<\/span>nextInt<\/span>(<\/span>)<\/span>;<\/span> \/\/ \u8868\u793a\u5c06\u952e\u76d8\u5f55\u5165\u7684\u503c\u4f5c\u4e3aint\u6570\u8fd4\u56de\u3002<\/span>\n<\/code><\/pre>\n

            \u793a\u4f8b\uff1a
            \"Java\u5165\u95e8\u4e4b~Java\u57fa\u7840\u8bed\u6cd5<\/p>\n

            \"Java\u5165\u95e8\u4e4b~Java\u57fa\u7840\u8bed\u6cd5<\/p>\n

            \u6539\u5199\u4e09\u4e2a\u548c\u5c1a\u6848\u4f8b\uff0c\u6570\u636e\u4f7f\u7528\u952e\u76d8\u5f55\u5165\u3002<\/p>\n

            \"Java\u5165\u95e8\u4e4b~Java\u57fa\u7840\u8bed\u6cd5<\/p>\n

            \"Java\u5165\u95e8\u4e4b~Java\u57fa\u7840\u8bed\u6cd5
            \"Java\u5165\u95e8\u4e4b~Java\u57fa\u7840\u8bed\u6cd5<\/p>\n

            8.\u9047\u89c1Ara\u9047\u89c1\u4f60<\/h2>\n","protected":false},"excerpt":{"rendered":"Java\u5165\u95e8\u4e4b~Java\u57fa\u7840\u8bed\u6cd5Java\u5165\u95e8\u4e4b\u57fa\u7840\u8bed\u6cd5\u7bc7\uff0c\u6536\u85cf\u5b66\u8d77\u6765_java\u8bed\u6cd5","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/3748"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=3748"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/3748\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=3748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=3748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=3748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}