\nl\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\nJava\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\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 |
\n\n\u6574\u6570<\/td>\n | byte<\/td>\n | 1<\/td>\n | \u8d1f\u76842\u76847\u6b21\u65b9 ~ 2\u76847\u6b21\u65b9-1(-128~127)<\/td>\n<\/tr>\n |
\n<\/td>\n | short<\/td>\n | 2<\/td>\n | \u8d1f\u76842\u768415\u6b21\u65b9 ~ 2\u768415\u6b21\u65b9-1(-32768~32767)<\/td>\n<\/tr>\n |
\n<\/td>\n | int<\/td>\n | 4<\/td>\n | \u8d1f\u76842\u768431\u6b21\u65b9 ~ 2\u768431\u6b21\u65b9-1<\/td>\n<\/tr>\n |
\n<\/td>\n | long<\/td>\n | 8<\/td>\n | \u8d1f\u76842\u768463\u6b21\u65b9 ~ 2\u768463\u6b21\u65b9-1<\/td>\n<\/tr>\n |
\n\u6d6e\u70b9\u6570<\/td>\n | float<\/td>\n | 4<\/td>\n | 1.401298e-45 ~ 3.402823e+38<\/td>\n<\/tr>\n |
\n<\/td>\n | double<\/td>\n | 8<\/td>\n | 4.9000000e-324 ~ 1.797693e+308<\/td>\n<\/tr>\n |
\n\u5b57\u7b26<\/td>\n | char<\/td>\n | 2<\/td>\n | 0-65535<\/td>\n<\/tr>\n |
\n\u5e03\u5c14<\/td>\n | boolean<\/td>\n | 1<\/td>\n | true\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>\n3.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>\nint<\/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
|