{"id":31272,"date":"2022-11-18T22:50:44","date_gmt":"2023-04-10T19:42:23","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/"},"modified":"2025-08-12T23:10:39","modified_gmt":"2025-08-12T15:10:39","slug":"java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/","title":{"rendered":"Java\u7f16\u7801\u89c4\u8303"},"content":{"rendered":"<p>\u9996\u5148<\/p>\n<p>\u8bf7\u6ce8\u610f\u4ee5\u4e0b\u4e8b\u9879\uff0c\u5e76\u8fd0\u7528\u5b83\u4eec\u6765\u63d0\u9ad8Java\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u4fe1\u8d56\u6027\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5305\u62ec\u7684\u306b\u8ff0\u3079\u305f\u3082\u306e\u3067\u306f\u306a\u3044.<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u4ed6\u306f\u4e00\u822c\u5e38\u8b58\u3001\u81ea\u5206\u306e\u30eb\u30fc\u30eb\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30eb\u30fc\u30eb\u306b\u5f93\u3046\u3053\u3068.<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u504f\u5c48(\u7b11)\u306a\u3082\u306e\u3082\u3042\u308b\u306e\u3067\u3001\u541f\u5473\u30fb\u7d0d\u5f97\u3057\u305f\u3046\u3048\u3067\u4f7f\u7528\u3059\u308b\u3053\u3068.<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30eb\u30fc\u30eb\u96c6\u306a\u306e\u3067\u300c\u30eb\u30fc\u30ebA\u3092\u5b9f\u65bd\u3059\u308c\u3070\u30eb\u30fc\u30ebB\u306f\u4e0d\u8981\u3042\u308b\u3044\u306f\u4e0d\u53ef\u80fd\u300d\u306a\u3082\u306e\u306f\u542b\u307e\u308c\u3066\u3044\u308b.<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u300c\u30a4\u30f3\u30c7\u30f3\u30c8\u306f&#8230;.\u300d\u306a\u3069\u3068\u8a00\u3063\u305f\u3042\u308a\u304c\u3061\u306a\u3082\u306e\u306f\u5165\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u4ed6\u306e\u30b5\u30a4\u30c8\u3092\u53c2\u7167\u3055\u308c\u305f\u3044.<\/ul>\n<h1>\u89c4\u5219\u9996\u5148\u53ea\u63d0\u4f9b\u89c4\u5219\u3002\u89e3\u91ca\u5728\u540e\u9762\u53c2\u8003\u3002<\/p>\n<h2>\u53d8\u91cf\u548c\u5e38\u91cf<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">boolean(Boolean)\u306f\u5f15\u6570\u306b\u306f\u4f7f\u7528\u3057\u306a\u3044\u21d2enum\u3092\u4f7f\u7528\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">boolean(Boolean)\u306f\u518d\u5b9a\u7fa9\u3057\u3066\u4f7f\u7528\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">boolean(Boolean)\u306f\u5426\u5b9a\u5f62\u306e\u540d\u79f0\u306f\u4f7f\u308f\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u3067\u304d\u308b\u3060\u3051String\u306f\u4f7f\u7528\u3057\u306a\u3044\u21d2String\u5185\u5305\u306e\u30af\u30e9\u30b9\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">null\u306f\u518d\u5b9a\u7fa9\u3057\u3066\u4f7f\u7528\u3059\u308b\u21d2\u30af\u30e9\u30b9\u540d+IS_NULL<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">int\u5b9a\u6570\u306f\u4f7f\u7528\u3057\u306a\u3044\u21d2enum\u3092\u4f7f\u7528\u3059\u308b.<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">int\u5b9a\u6570\u306fInteger\u5909\u6570\u306f\u4f7f\u7528\u3057\u306a\u3044\u21d2==\u5224\u5b9a\u306e\u30d0\u30b0\u3092\u907f\u3051\u308b\u305f\u3081.<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u96e2\u6563\u72b6\u614b\u3092\u8868\u3059String\u5b9a\u6570\u306f\u4f7f\u7528\u3057\u306a\u3044\u21d2enum\u3092\u4f7f\u7528\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u4e8b\u524d\u306b\u5b9a\u7fa9\u3055\u308c\u5b9f\u884c\u6642\u306b\u5909\u5316\u3057\u306a\u3044\u3082\u306e\u306fList\u3067\u306f\u306a\u304f\u914d\u5217\u306b\u3059\u308b\u3001\u30ed\u30b8\u30c3\u30af\u3067\u751f\u6210\u3059\u308b\u3082\u306e\u306f\u914d\u5217\u3067\u306f\u306a\u304fList\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5b9a\u6570\u3092\u30cf\u30fc\u30c9\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3057\u306a\u3044.<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5909\u6570\u306e\u4f7f\u3044\u307e\u308f\u3057\u306f\u907f\u3051\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5909\u6570\u3078\u306e\u518d\u4ee3\u5165\u3092\u306a\u308b\u3079\u304f\u907f\u3051\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u578b\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u5148\u982d\u306b$\u3092\u3064\u3051\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u5909\u6570\u540d\u3067\u696d\u52d9\u56fa\u6709\u306e\u540d\u79f0\u3092\u3064\u3051\u308b\u5fc5\u8981\u304c\u306a\u3044\u5834\u5408\u306f\u3001\u5909\u6570\u306e\u578b\u3092\u9023\u60f3\u3059\u308b\u540d\u79f0\u3068\u3059\u308b<\/ul>\n<h2>\u7c7b\u522b\u5b9a\u4e49<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30af\u30e9\u30b9(\u4eee\u79f0:\u30c7\u30fc\u30bf\u3092\u5165\u308c\u308b\u30af\u30e9\u30b9)\u306f\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u307e\u3068\u3081\u3066\u5148\u982d\u306b\u8a18\u8ff0\u3057\u30d5\u30a3\u30fc\u30eb\u30c9\u30b3\u30e1\u30f3\u30c8\u306f\u4e00\u884c\u306b\u3059\u308b.<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30ed\u30b8\u30c3\u30af\u30af\u30e9\u30b9(\u4eee\u79f0:\u30ed\u30b8\u30c3\u30af\u4e2d\u5fc3\u306e\u30af\u30e9\u30b9)\u306f\u30d5\u30a3\u30fc\u30eb\u30c9\u306f\u6700\u5f8c\u306b\u8a18\u8ff0\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">class\u306epublic\u306f\u5fc5\u8981\u306a\u6642\u3060\u3051\u3064\u3051\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u306f\u3001\u5b9f\u8cea\u7684\u306a\u51e6\u7406\u306f\u884c\u308f\u305a\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u521d\u671f\u5316\u304f\u3089\u3044\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u521d\u671f\u5316\u306f\u30e1\u30bd\u30c3\u30c9\u306b\u3057\u3066final\u3092\u3064\u3051\u308b.<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u521d\u671f\u5316\u30e1\u30bd\u30c3\u30c9\u540d\u306f\u30b7\u30b9\u30c6\u30e0\u5185\u3067\u7d71\u4e00\u3057\u3066\u304a\u304f(init\u306a\u3069)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3084\u30e1\u30bd\u30c3\u30c9\u3067\u51e6\u7406\u304c\u306a\u3044\u3068\u304d\u306f\u300c\u51e6\u7406\u306a\u3057\u300d\u3068\u8a18\u8ff0\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30af\u30e9\u30b9\u306fComparator\u3092\u4f5c\u6210\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u8907\u6570\u306e\u30ed\u30b8\u30c3\u30af\u30af\u30e9\u30b9\u304b\u3089\u5229\u7528\u3055\u308c\u308b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30af\u30e9\u30b9\u306f\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5206\u3051\u308b\u3053\u3068\u3082\u8003\u3048\u308b.<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5b9a\u6570\u3060\u3051\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u306a\u3044\u21d2\u30af\u30e9\u30b9\u306b\u3059\u308b\u21d2implements\u3055\u308c\u308b\u3068\u308f\u304b\u3089\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">static\u30d6\u30ed\u30c3\u30af\u3067\u4f8b\u5916\u3092\u767a\u751f\u305b\u3056\u308b\u3092\u5f97\u306a\u3044\u5834\u5408\u21d2\u30ed\u30b0&amp;RuntimeException<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u30af\u30e9\u30b9\u5185\u306b\u30ed\u30fc\u30ab\u30eb\u306a\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3059\u308b<\/ul>\n<h2>\u5b9e\u73b0\u548c\u7ee7\u627f<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u306eComparator,Iterator\u306a\u3069\u306f\u30c0\u30df\u30fc\u3092\u4f5c\u6210\u3057\u3001\u305d\u308c\u3092\u4f7f\u7528\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5b9f\u88c5\u3001\u7d99\u627f\u3067\u306f\u5143\u306e\u540d\u524d\u3092\u5148\u982d\u306b\u3064\u3051\u305f\u540d\u524d\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u57fa\u5e95\u30af\u30e9\u30b9\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u308f\u305b\u305f\u304f\u306a\u3044\u6642\u306fRuntimeException\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30af\u30e9\u30b9\u5b9a\u7fa9\u3084\u30e1\u30bd\u30c3\u30c9\u306b\u306f\u5fc5\u8981\u306a\u6642\u306b\u306ffinal\u3064\u3051\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30af\u30e9\u30b9\u306ftoString\u3092\u5b9f\u88c5\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30af\u30e9\u30b9\u306fequals,hashCode,Comparable,clone\u3092\u5b9f\u88c5\u3059\u308b.<\/ul>\n<h2>\u65b9\u6cd5<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30e1\u30bd\u30c3\u30c9\u306e\u540d\u79f0\u306b\u5426\u5b9a\u5f62\u306f\u4f7f\u7528\u3057\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">List\u306a\u3069\u306e\u8fd4\u5024\u306f\u5024\u304c\u306a\u3044\u6642\u306femtpy(\u30b5\u30a4\u30ba\u304c\u30bc\u30ed)\u3088\u308a\u3082null\u3092\u623b\u3059<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u8fd4\u5024\u304c\u6b63\u5e38\u304b\u3069\u3046\u304b\u3092\u5224\u5b9a\u3059\u308bstatic\u30e1\u30bd\u30c3\u30c9\u3092\u5143\u306e\u30af\u30e9\u30b9\u306b\u4f5c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u8fd4\u5024\u304cboolean\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u3001if\u6587\u306b\u4f7f\u7528\u3057\u3066\u99b4\u67d3\u3080\u540d\u524d\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u5185\u90e8\u306eList,Set,Map\u306a\u3069\u306f\u30e1\u30bd\u30c3\u30c9\u306e\u623b\u308a\u5024\u306b\u3057\u306a\u3044\u3001\u5fc5\u8981\u306a\u3089\u3070\u30b3\u30d4\u30fc\u3092\u623b\u3059<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u8907\u6570\u306e\u8fd4\u5024\u3092\u623b\u3057\u305f\u3044\u3068\u304d\u306b\u3069\u3046\u3059\u308b\u304b\u21d2\u30af\u30e9\u30b9\u3092\u4f5c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u8907\u6570\u306e\u8fd4\u5024\u3092\u623b\u3057\u305f\u3044\u3068\u304d\u306b\u3069\u3046\u3059\u308b\u304b\u21d2\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u914d\u5217\u3092\u623b\u3059\u21d2\u5024\u306e\u53d6\u51fa\u3057static\u30e1\u30bd\u30c3\u30c9\u3092\u4f5c\u6210\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5185\u90e8\u30c7\u30fc\u30bf\u304c\u4e0d\u5fc5\u8981\u306a\u30e1\u30bd\u30c3\u30c9\u306fstatic\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Overload\u306f\u306a\u308b\u3079\u304f\u3057\u306a\u3044\u21d2\u30bd\u30fc\u30b9\u304c\u5206\u304b\u308a\u3084\u3059\u304f\u306a\u308b<\/ul>\n<h2>\u903b\u8f91<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u51e6\u7406\u30b9\u30d4\u30fc\u30c9\u3088\u308a\u3082\u5206\u304b\u308a\u3084\u3059\u3044\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u5fc3\u304c\u3051\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30ed\u30b8\u30c3\u30af\u304c\u300c\u96e3\u3057\u3044\u3001\u3084\u3084\u3053\u3057\u3044\u300d\u3068\u601d\u3063\u305f\u3089\u3001\u4e00\u5ea6\u306f\u8003\u3048\u76f4\u3059<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u307e\u3068\u307e\u3063\u305f\u51e6\u7406\u306f\u30d6\u30ed\u30c3\u30af\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">else\u6587\u3067\u306f\u6539\u884c\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u4e09\u9805\u6f14\u7b97\u5b50\u3092\u4f7f\u3046<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">if\u6587\u306e\u5185\u5bb9\u304cbreak,continue,return,throw\u3060\u3051\u3067\u3042\u308c\u3070\u3001if\u6587\u3068\u540c\u4e00\u884c\u306b\u8a18\u8ff0\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">String\u306e\u7b49\u5024\u5224\u5b9a\u306fequals\u3092\u4f7f\u7528\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">String\u306e\u7b49\u5024\u5224\u5b9a\u306f\u5b9a\u6570\u3092\u4e3b\u8a9e\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Boolean\u306fnew\u3057\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">null\u306f\u578b\u3092\u660e\u793a\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">if,for,while\u306f\u4e00\u6587\u3067\u3082\u30d6\u30ed\u30c3\u30af\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u9806\u756a\u3092\u610f\u8b58\u3059\u308b\u30eb\u30fc\u30d7\u3067\u306f\u62e1\u5f35for\u6587\u3092\u4f7f\u7528\u3057\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5206\u5c90(if,switch)\u3092\u4f7f\u308f\u305a\u306b\u5b9a\u6570\u30c6\u30fc\u30d6\u30eb\u3067\u5207\u308a\u5206\u3051\u308b\u3053\u3068\u3082\u8003\u3048\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">else\u3067\u51e6\u7406\u304c\u306a\u3044\u6642\u306f\u300c\u51e6\u7406\u306a\u3057\u300d\u306e\u30b3\u30e1\u30f3\u30c8\u3092\u3057\u3066\u304a\u304f<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">if\u6587\u306e\u8907\u5408\u6761\u4ef6\u3092\u5206\u89e3\u3057\u3066\u3001\u30cd\u30b9\u30c8\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u8907\u5408\u6761\u4ef6\u306f\u62ec\u5f27\u3067\u5206\u96e2\u30fb\u660e\u793a\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u3067\u304d\u308b\u3060\u3051\u4f7f\u3044\u307e\u308f\u3057\u3057\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">static\u30e1\u30bd\u30c3\u30c9\u547c\u3073\u51fa\u3057\u306f\u5fc5\u305a\u30af\u30e9\u30b9\u540d\u306b\u3059\u308b.\u5909\u6570\u540d\u306b\u306f\u3057\u306a\u3044.\u81ea\u30af\u30e9\u30b9\u3067\u3082\u30af\u30e9\u30b9\u540d\u3092\u66f8\u304f\u3001<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">StringBuilder(StringBuffer)\u306f\u3067\u304d\u308b\u3060\u3051\u4f7f\u308f\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5358\u4f53\u30c6\u30b9\u30c8\u3057\u3084\u3059\u3044\u3088\u3046\u306b\u30e1\u30e2\u30ea\u4e0a\u306e\u30ed\u30b8\u30c3\u30af\u3092\u30e1\u30bd\u30c3\u30c9\u306b\u5916\u3060\u3057\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">List,Set,Map\u306a\u3069\u306b\u4e0b\u4f4d\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u8ffd\u52a0\u3059\u308b\u3068\u304d\u306f\u3001\u4e0b\u4f4d\u30aa\u30d6\u30b8\u30a7\u30af\u30c8new\u76f4\u5f8c\u306b\u8ffd\u52a0\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u4f8b\u5916\u51e6\u7406\u3067\u306ffinaly\u306f\u5fc5\u305a\u3064\u3051\u308b\u3001\u539f\u5247catch\u306f\u3057\u306a\u3044<\/ul>\n<h2>\u5171\u901a\u7684\u8bfe\u7a0b<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u65e5\u6642\u51e6\u7406\u306f\u5171\u901a\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3059\u308b\u21d2\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u7d71\u4e00\u3001\u65e5\u6642\u51e6\u7406\u306e\u7d71\u4e00<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30ea\u30d5\u30ec\u30af\u30b7\u30e7\u30f3\u3001\u901a\u4fe1\u3001IO\u306a\u3069\u306f\u5171\u901a\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3059\u308b\u21d2\u4ed6\u306e\u30ed\u30b8\u30c3\u30af\u3068\u6df7\u5728\u3092\u907f\u3051\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30e1\u30bd\u30c3\u30c9\u306e\u5f15\u6570\u306e\u6570\u5024\u306e\u914d\u5217\u306fprimitive\u3067\u306f\u306a\u304fwrapper\u306b\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30af\u30e9\u30b9\u540d\u3084\u30e1\u30bd\u30c3\u30c9\u540d\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u306b\u6d3e\u751f\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u306e\u5171\u901a\u30af\u30e9\u30b9\u306e\u6574\u5099\u306f\u3001\u30b3\u30b9\u30c8\u30a2\u30c3\u30d7\u306b\u306a\u308b\u304c\u3001\u63a8\u9032\u3059\u3079\u304d<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u4f01\u696d\u5185\u3067\u3042\u308c\u3070\u3001\u9577\u671f\u7684\u5c55\u671b\u3092\u3082\u3063\u3066\u3001\u6574\u5099\u3057\u3066\u3044\u304f\u3079\u304d<\/ul>\n<h1>\u8bb2\u89e3<\/p>\n<h2>\u53d8\u91cf\u548c\u5e38\u91cf<\/p>\n<h3>\u5e03\u5c14\u7c7b\u578b(Boolean)\u4e0d\u5e94\u8be5\u4f5c\u4e3a\u53c2\u6570\u4f7f\u7528\uff0c\u5e94\u8be5\u4f7f\u7528\u679a\u4e3e(enum)\u3002\u5f53\u5c06boolean\u7528\u4f5c\u65b9\u6cd5\u7684\u53c2\u6570\u65f6\uff0c\u5f88\u96be\u7406\u89e3\u3002<br \/>\n\u9700\u8981\u786e\u8ba4\u65b9\u6cd5\u7684\u89c4\u683c\u624d\u80fd\u7406\u89e3\u3002<br \/>\n\u5982\u679c\u4f7f\u7528enum\uff0c\u610f\u4e49\u5c31\u66f4\u52a0\u6e05\u6670\u4e86\u3002<br \/>\n\u5728\u65b9\u6cd5\u5185\u90e8\u8fdb\u884c\u5c40\u90e8\u4f7f\u7528\u6216\u4f5c\u4e3a\u65b9\u6cd5\u7684\u8fd4\u56de\u503c\uff0c\u6ca1\u6709\u4ec0\u4e48\u95ee\u9898\u3002<\/p>\n<h3>\u5728\u4e2d\u6587\u4e2d\u91cd\u65b0\u5b9a\u7fa9\u548c\u4f7f\u7528boolean(Boolean)\u3002<br \/>\nisActive\u7684\u5e03\u5c14\u503c\u4e3atrue\u3002<\/p>\n<p>\u4e0b\u8ff0\u7684\u6bd4\u4e0a\u8ff0\u7684\u66f4\u5bb9\u6613\u7406\u89e3\u3002<\/p>\n<p>boolean ACTIVE = true;<br \/>\nboolean IN_ACTIVE = false;<br \/>\nboolean status = IN_ACTIVE;<\/p>\n<p>\u5e03\u5c14\u7c7b\u578b ACTIVE = true;<br \/>\n\u5e03\u5c14\u7c7b\u578b IN_ACTIVE = false;<br \/>\n\u5e03\u5c14\u7c7b\u578b status = IN_ACTIVE;<\/p>\n<p>\u5982\u679c\u5c06\u5176\u4f5c\u4e3a\u65b9\u6cd5\u53c2\u6570\uff0c\u4e5f\u80fd\u7406\u89e3\u5176\u610f\u4e49\uff0c\u4f46\u5373\u4f7f\u4f20\u9012\u4e0d\u540c\u542b\u4e49\u7684boolean\uff0c\u4e5f\u4e0d\u4f1a\u7f16\u8bd1\u9519\u8bef\u3002\u5b9e\u9645\u4e0a\uff0c\u4f7f\u7528enum\u4f1a\u66f4\u597d\u3002<\/p>\n<h3>boolean\uff08\u5e03\u5c14\uff09\u4e0d\u4f7f\u7528\u5426\u5b9a\u5f62\u5f0f\u7684\u540d\u79f0\u8fd9\u4e2a\u7406\u7531\u5f88\u96be\u7406\u89e3\uff0c\u5f53\u5728\u5426\u5b9a\u6761\u4ef6\u4e0b\u66f4\u96be\u7406\u89e3\uff0c\u518d\u52a0\u4e0a\u5176\u4ed6\u6761\u4ef6\u4e00\u8d77\u66f4\u96be\u7406\u89e3\u3002<\/p>\n<p>boolean notFound = true;<br \/>\nif (! notFound) {<br \/>\n\/\/ \u898b\u3064\u304b\u3063\u305f\u6642\u306e\u51e6\u7406.<br \/>\n}<\/p>\n<p>\u5e03\u5c14\u503c\u672a\u627e\u5230 = true;<br \/>\n\u5982\u679c (!\u5e03\u5c14\u503c\u672a\u627e\u5230) {<br \/>\n\/\/ \u88ab\u627e\u5230\u65f6\u7684\u5904\u7406.<br \/>\n}<\/p>\n<h3>\u5c3d\u91cf\u907f\u514d\u4f7f\u7528String\u21d2\u6539\u4e3a\u4f7f\u7528\u5b57\u7b26\u4e32\u5305\u88c5\u7c7b\u7406\u7531\u662f\u56e0\u4e3a\u4ee5String\u7684\u5f62\u5f0f\u4e0d\u5bb9\u6613\u7406\u89e3\u3002<br \/>\n\u540d\u5b57\u662fString\uff0c\u4f4f\u5740\u662fString\uff0c\u516c\u53f8\u540d\u662fString\uff0c\u90e8\u95e8\u540d\u4e5f\u662fString\u90fd\u65e0\u6cd5\u4e86\u89e3\u3002<br \/>\n\u65e0\u8bba\u8fdb\u884c\u602a\u5f02\u7684\u8d4b\u503c\u8fd8\u662f\u4f20\u5165\u9519\u8bef\u7684\u53c2\u6570\u90fd\u4e0d\u4f1a\u5bfc\u81f4\u7f16\u8bd1\u9519\u8bef\u3002<br \/>\n\u5176\u5b9e\u6211\u5f88\u60f3\u5b9a\u4e49\u4e00\u4e2a\u7c7bCompanyName\u7ee7\u627fString\uff0c\u4f46\u662f\u4e0d\u53ef\u4ee5\uff0c\u56e0\u4e3aString\u662ffinal\u7c7b\u578b\u3002<br \/>\n\u56e0\u6b64\u6211\u4f1a\u5b9a\u4e49\u4e00\u4e2a\u7c7bCompanyName\uff0c\u5176\u4e2d\u5305\u542b\u4e00\u4e2a\u79c1\u6709String\u6210\u5458\u53d8\u91cf\u3002<\/p>\n<p>\u7136\u800c\uff0c\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\u90fd\u8981\u5c1d\u8bd5\u8fd9\u6837\u505a\u53ef\u80fd\u4f1a\u76f8\u5f53\u9ebb\u70e6\u3002<br \/>\n\u9700\u8981\u91cd\u65b0\u5b9a\u4e49String\u7c7b\u7684\u65b9\u6cd5\uff08\u53ea\u9700\u5fc5\u8981\u7684\u90e8\u5206\uff09\u3002<br \/>\n\u5728\u4f7f\u7528\u5916\u90e8\u5e93\u65f6\uff0c\u603b\u662f\u9700\u8981\u8fdb\u884c\u8f6c\u6362\u548c\u9006\u8f6c\u6362\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5c06\u5c01\u95ed\u5728\u81ea\u5df1\u7684\u7cfb\u7edf\u4e2d\u7684\u5185\u5bb9\u521b\u5efa\u4e3aString\u5185\u5305\u7c7b\u3002<br \/>\n\u5c06\u9700\u8981\u4e0e\u5916\u90e8\u5e93\u8fdb\u884c\u4f20\u9012\u7684\u5185\u5bb9\u575a\u6301\u4f7f\u7528String\u3002<\/p>\n<h3>\u5c06null\u8fdb\u884c\u91cd\u65b0\u5b9a\u4e49\u5e76\u4f7f\u7528 \u21d2 \u7c7b\u540d+IS_NULL\u5f53\u5c06null\u8d4b\u503c\u6216\u4f20\u9012\u7ed9\u65b9\u6cd5\u65f6\uff0c\u5176\u542b\u4e49\u4e0d\u660e\u786e\uff0c\u5c24\u5176\u662f\u5728\u4f20\u9012\u7ed9\u65b9\u6cd5\u65f6\u3002<\/p>\n<p>\u5730\u5740\u7c7b\uff1a<br \/>\n\/\/ \u7701\u7565\u5904\u7406<\/p>\n<p>\u6211\u7684\u7c7b\uff1a<br \/>\npublic void \u65b9\u6cd5(\u5730\u5740 addr)\uff1a<br \/>\n\/\/ \u7701\u7565\u5904\u7406<\/p>\n<p>\u8fd9\u6837\u7684\u8bdd\uff0c\u4e0d\u6e05\u695a\u4f20\u9012\u4e86\u4ec0\u4e48\u6837\u7684null\u3002<br \/>\nMyClass myObj = new MyClass();<br \/>\nmyObj.method(null); \/\/ \u21d2 \u4e0d\u6e05\u695a\u529e\u6cd5<\/p>\n<p>\u5982\u679c\u6309\u7167\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c:<br \/>\nAddress Address_IS_NULL = (Address)null;<br \/>\nmyObj.method(Address_IS_NULL); \/\/ \u21d2 \u66f4\u5bb9\u6613\u7406\u89e3<\/p>\n<p>\u5982\u679c\u4ee5\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c\uff1a<\/p>\n<p>\u6ce8\uff1a\u5728\u5b9a\u4e49null\u65f6\uff0c\u6700\u597d\u662f\u5728\u7c7b\uff08\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\u662fAddress\u7c7b\uff09\u5185\u90e8\u8fdb\u884c\u5b9a\u4e49\u3002<br \/>\n\u5f15\u7528Address.IS_NULL\u3002<br \/>\n\u7136\u800c\uff0c\u5f53\u4e0d\u662f\u81ea\u5df1\u8d1f\u8d23\u65f6\uff0c\u53ef\u4ee5\u91c7\u7528\u4e0a\u8ff0\u7684\u65b9\u5f0f\u3002<\/p>\n<h3>\u4e0d\u4f7f\u7528int\u5e38\u6570\uff0c\u800c\u662f\u4f7f\u7528enum\u3002\u5982\u679c\u4f7f\u7528 int\uff0c\u5373\u4f7f\u8d4b\u4e88\u4e86\u975e\u6cd5\u503c\u4e5f\u4e0d\u4f1a\u88ab\u68c0\u67e5\u3002\u4f46\u662f\u5728\u73b0\u6709\u7cfb\u7edf\u4e2d\u5982\u679c\u4f7f\u7528\u4e86 int \u5e38\u91cf\uff0c\u5219\u4f7f\u7528 int \u5e38\u91cf\u662f\u4e0d\u53ef\u907f\u514d\u7684\u3002<\/p>\n<p>\/\/ \u4f7f\u7528int\u5b9a\u4e49\u6027\u522b<br \/>\nfinal int GENDER_MALE = 1;<br \/>\nfinal int GENDER_FEMALE = 2;<br \/>\nint intGender = GENDER_MALE;<br \/>\nintGender = 100; \/\/ \u4e0d\u4f1a\u5bfc\u81f4\u7f16\u8bd1\u9519\u8bef<\/p>\n<p>\u7528\u679a\u4e3e\u6765\u8868\u793a\u53ef\u80fd\u6bd4\u4e0a\u8ff0\u65b9\u6cd5\u66f4\u597d\u3002<br \/>\nGender enumGender = Gender.MALE;<\/p>\n<h3>\u4e3a\u4e86\u907f\u514d\u76f8\u7b49\u5224\u65ad\u7684Bug\uff0c\u4e0d\u8981\u4f7f\u7528int\u5e38\u91cf\u7b49\u540c\u4e8eInteger\u53d8\u91cf\u3002\u8fd9\u5c06\u88ab\u5224\u5b9a\u4e3a\u5047\u3002<br \/>\n\u5982\u679c\u51fa\u73b0\u9519\u8bef\uff0c\u5219\u65e0\u6cd5\u786e\u5b9a\u3002<\/p>\n<h3>\u4e0d\u8981\u4f7f\u7528\u8868\u793a\u79bb\u6563\u72b6\u6001\u7684\u5b57\u7b26\u4e32\u5e38\u91cf\u21d2\u4f7f\u7528\u679a\u4e3e\u5982\u679c\u6ca1\u6709\u4f7f\u7528int\u5e38\u91cf\uff0c\u90a3\u4e48\u8fd9\u4e5f\u548c\u4e0d\u4f7f\u7528\u5b83\u4e00\u6837\u3002\u65e0\u6548\u7684\u503c\u5c06\u4e0d\u4f1a\u88ab\u68c0\u67e5\u3002<br \/>\n\u4f46\u662f\u5982\u679c\u5728\u73b0\u6709\u7cfb\u7edf\u4e2d\u4f7f\u7528\u4e86String\u5e38\u91cf\uff0c\u90a3\u662f\u65e0\u53ef\u5948\u4f55\u7684\u3002<\/p>\n<p>\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\u4e32\u53d8\u91cf\u4e0d\u4f1a\u5bfc\u81f4\u7f16\u8bd1\u9519\u8bef\u3002<\/p>\n<p>\u5c06\u4e0a\u8ff0\u5185\u5bb9\u6539\u4e3a\u679a\u4e3e\u7c7b\u578b\u3002<br \/>\n\u6027\u522b\u679a\u4e3e\u7c7b\u578b enumGender = Gender.FEMALE\u3002<\/p>\n<p>\u5982\u679c\u5728\u6570\u636e\u5e93\u4e0a\u662f\u4ee5\u6570\u5b57\u6216\u6587\u672c\u5f62\u5f0f\uff0c\u800c\u5728\u5185\u5b58\u4e2d\u662f\u679a\u4e3e\u7c7b\u578b\uff0c\u5219\u517c\u5bb9\u6027\u4e0d\u4f73\uff0c\u9700\u8981\u8fdb\u884c\u76f8\u4e92\u8f6c\u6362\u3002\u901a\u8fc7\u5728\u8be5\u679a\u4e3e\u7c7b\u578b\u4e2d\u5b9e\u73b0\u9759\u6001\u7684fromInt\uff08fromString\uff09\u65b9\u6cd5\u548ctoInt\uff08toString\uff09\u65b9\u6cd5\uff0c\u5c31\u80fd\u521b\u5efa\u4e00\u4e2a\u901a\u7528\u7c7b\u6765\u8fdb\u884c\u8f6c\u6362\u3002<\/p>\n<h3>\u5982\u679c\u5728\u6267\u884c\u65f6\u4e0d\u53d1\u751f\u53d8\u5316\u7684\u4e8b\u9879\uff0c\u5e94\u8be5\u4f7f\u7528\u6570\u7ec4\u800c\u4e0d\u662f\u5217\u8868\u6765\u5b9a\u4e49\u3002\u800c\u9700\u8981\u5728\u903b\u8f91\u4e2d\u751f\u6210\u7684\u4e8b\u9879\uff0c\u5219\u5e94\u8be5\u4f7f\u7528\u5217\u8868\u800c\u4e0d\u662f\u6570\u7ec4\u3002\u5728\u51b3\u5b9a\u4f7f\u7528\u6570\u7ec4\u8fd8\u662f\u5217\u8868\u65f6\u53ef\u80fd\u4f1a\u611f\u5230\u56f0\u60d1\uff0c\u4f46\u8bbe\u5b9a\u8fd9\u6837\u7684\u539f\u5219\u4f1a\u5f88\u6709\u5e2e\u52a9\u3002<\/p>\n<h3>\u4e0d\u8981\u5bf9\u56fa\u5b9a\u6570\u8fdb\u884c\u786c\u7f16\u7801\u3002\u5982\u679c\u53ea\u5199\u4e0b\u4e00\u4e2a\u5e38\u6570\uff0c\u90a3\u5c31\u65e0\u6cd5\u7406\u89e3\u5176\u542b\u4e49\u3002<br \/>\n\u5728\u8fdb\u884c\u4fee\u6b63\u65f6\uff0c\u53ef\u80fd\u4f1a\u9519\u8bef\u5730\u4fee\u6b63\u5176\u4ed6\u90e8\u5206\u5904\u4e8e\u76f8\u540c\u503c\u7684\u5730\u65b9\u3002<\/p>\n<p>\/\/ \u5f53\u628astatus\u7684\u503c\u6539\u4e3a\u5176\u4ed6\u503c\u65f6\uff0c\u53ef\u80fd\u4f1a\u8bef\u6539gender\u7684\u503c\uff0c\u8fd9\u6837\u5c31\u65e0\u6cd5\u7406\u89e3\u5176\u610f\u4e49\u3002<br \/>\nint status = 1; \/\/ \u65e0\u6cd5\u7406\u89e3\u5176\u610f\u4e49<br \/>\nint gender = 1; \/\/ \u65e0\u6cd5\u7406\u89e3\u5176\u610f\u4e49<\/p>\n<p>\u5c06\u4ee5\u4e0b\u5185\u5bb9\u8fdb\u884c\u91cd\u8ff0\uff0c\u4ee5\u4f7f\u5176\u66f4\u6613\u7406\u89e3\uff0c\u4e14\u65e0\u9700\u8fdb\u884c\u66f4\u6539\u3002<br \/>\n\u72b6\u6001\u5e38\u91cfSTATUS_ACTIVE\u7684\u503c\u4e3a1\uff1b<br \/>\n\u72b6\u6001\u5e38\u91cfSTATUS_INACTIVE\u7684\u503c\u4e3a2\uff1b<br \/>\n\u6027\u522b\u5e38\u91cfGENDER_MALE\u7684\u503c\u4e3a1\uff1b<br \/>\n\u6027\u522b\u5e38\u91cfGENDER_FEMALE\u7684\u503c\u4e3a2\uff1b<br \/>\nstatus\u53d8\u91cf\u7684\u503c\u4e3aSTATUS_ACTIVE\uff0c\u5bb9\u6613\u7406\u89e3\uff1b<br \/>\ngender\u53d8\u91cf\u7684\u503c\u4e3aGENDER_MALE\uff0c\u5bb9\u6613\u7406\u89e3\u3002<\/p>\n<p>\u6ce8\u610f\uff0c\u5bf9\u4e8e\u8fd9\u4e2a\u4f8b\u5b50\u6765\u8bf4\uff0c\u6700\u597d\u6539\u6210\u679a\u4e3e\u5f62\u5f0f\u3002<\/p>\n<h3>\u907f\u514d\u91cd\u590d\u4f7f\u7528\u53d8\u91cf\u4e00\u4e2a\u53d8\u91cf\u5e94\u8be5\u53ea\u7528\u4e8e\u4e00\u4e2a\u610f\u4e49\u3002<\/p>\n<p>\u867d\u7136\u6211\u77e5\u9053\u8fd9\u4e00\u70b9\uff0c\u4f46\u5728\u5fd9\u788c\u7684\u65f6\u5019\u8fd8\u662f\u53ef\u80fd\u51fa\u9519\uff0c\u6240\u4ee5\u8981\u6ce8\u610f\u3002<\/p>\n<h3>\u5c3d\u91cf\u907f\u514d\u5bf9\u53d8\u91cf\u8fdb\u884c\u91cd\u65b0\u8d4b\u503c\u3002\u591a\u6b21\u5bf9\u53d8\u91cf\u8fdb\u884c\u8d4b\u503c\u65f6\uff0c\u5f53\u4f7f\u7528\u8be5\u53d8\u91cf\u8fdb\u884c\u5904\u7406\u65f6\uff0c\u5176\u503c\u4f1a\u53d8\u5f97\u96be\u4ee5\u7406\u89e3\u3002<br \/>\n\u4ec0\u4e48\u60c5\u51b5\u624d\u88ab\u89c6\u4e3a&#8221;\u518d\u8d4b\u503c&#8221;\u662f\u5fae\u5999\u7684\u3002<br \/>\n\u4f8b\u5982\u4ee5\u4e0b\u60c5\u51b5\u5e94\u8be5\u6ca1\u6709\u95ee\u9898\u3002<br \/>\n\u5728\u5faa\u73af\u4e2d\u9010\u4e2a\u5904\u7406\u5b9e\u4f8b\u65f6\uff0c\u5c06\u503c\u8d4b\u7ed9\u5b9e\u4f8b\u53d8\u91cf\u6216\u76f8\u5173\u53d8\u91cf\u3002<br \/>\n\u8bbe\u7f6e\u521d\u59cb\u503c\uff0c\u5728\u67d0\u4e9b\u6761\u4ef6\u4e0b\u66f4\u65b0\u8be5\u503c\uff0c\u7136\u540e\u4f7f\u7528\u8be5\u53d8\u91cf\u8fdb\u884c\u5904\u7406\u3002<br \/>\n\u4e0d\u597d\u7684\u60c5\u51b5\u7684\u793a\u4f8b\u3002<br \/>\n\u5728\u5bf9\u53d8\u91cf\u8d4b\u503c\u540e\u4f7f\u7528\u8be5\u53d8\u91cf\u8fdb\u884c\u5904\u7406\uff0c\u7136\u540e\u518d\u6b21\u5c06\u5176\u503c\u8d4b\u7ed9\u8be5\u53d8\u91cf\uff0c\u518d\u6b21\u4f7f\u7528\u8be5\u53d8\u91cf\u8fdb\u884c\u5904\u7406\u3002<br \/>\n\u53c2\u8003&#8221;\u5c06\u4e00\u7cfb\u5217\u7684\u5904\u7406\u653e\u5165\u4ee3\u7801\u5757\u4e2d&#8221;\u3002<\/p>\n<h3>\u5728\u4e2d\u6587\u4e2d\uff0c\u7c7b\u578b\u53c2\u6570\u5728\u524d\u9762\u52a0\u4e0a$\u7b26\u53f7\u3002\u4e3a\u4e86\u6e05\u6670\u5730\u8bf4\u660e\u610f\u56fe\u662f\u901a\u8fc7\u7c7b\u578b\u53c2\u6570\u5b9e\u73b0\u7684\uff0c<br \/>\n\u5982\u679c\u4e0a\u8ff0\u610f\u56fe\u80fd\u591f\u5b9e\u73b0\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u65b9\u6cd5\uff0c\u4f46\u6700\u597d\u4e0d\u8981\u8fdd\u53cd\u5176\u4ed6\u89c4\u5219\u7684\u8303\u56f4\u3002<\/p>\n<h3>\u5982\u679c\u4e0d\u9700\u8981\u4e3a\u53d8\u91cf\u8d77\u7279\u5b9a\u4e8e\u4e1a\u52a1\u7684\u540d\u79f0\uff0c\u53ef\u4ee5\u5c06\u53d8\u91cf\u547d\u540d\u4e3a\u80fd\u591f\u8054\u60f3\u5230\u5176\u7c7b\u578b\u7684\u540d\u79f0\u3002\u5982\u679c\u662fString\u7c7b\u578b\uff0c\u53ef\u4ee5\u4f7f\u7528str\u7b49\u7b49\u3002<br \/>\n\u7279\u522b\u662f\u5728\u5171\u4eab\u7c7b\u4e2d\uff0c\u8fd9\u6837\u505a\u4f1a\u66f4\u597d\u3002<\/p>\n<h2>\u7c7b\u5b9a\u4e49<\/p>\n<h3>\u5b9e\u4f8b\u7c7b\uff08\u6682\u79f0\u4e3a\u6570\u636e\u5b58\u653e\u7c7b\uff09\u5c06\u5b57\u6bb5\u6574\u7406\u5728\u5f00\u5934\uff0c\u5e76\u5c06\u5b57\u6bb5\u6ce8\u91ca\u653e\u5728\u4e00\u884c\u4e2d\u3002\u4e3a\u4e86\u5feb\u901f\u4e86\u89e3\u5b57\u6bb5\u5217\u8868\uff0c\u539f\u56e0\u662f\u5e0c\u671b\u5728\u67e5\u770b\u6e90\u4ee3\u7801\u65f6\uff0c\u53ef\u4ee5\u4e00\u773c\u770b\u5230\u5f00\u5934\u90e8\u5206\u4ee5\u4fbf\u5feb\u901f\u7406\u89e3\u6709\u54ea\u4e9b\u5b57\u6bb5\u3002\u56e0\u6b64\uff0c\u53ea\u9700\u5728\u5f00\u5934\u90e8\u5206\u5b9a\u4e49\u5b57\u6bb5\u5e76\u5c06\u5b57\u6bb5\u6ce8\u91ca\u5199\u5165\u4e00\u884c\u800c\u4e0d\u6362\u884c\u3002<\/p>\n<h3>\u903b\u8f91\u7c7b\uff08\u6682\u5b9a\u540d\u79f0\uff1a\u903b\u8f91\u4e2d\u5fc3\u7c7b\uff09\u7684\u5b57\u6bb5\u5e94\u5728\u6700\u540e\u8fdb\u884c\u8bb0\u5f55\u3002\u5728\u903b\u8f91\u7c7b\u4e2d\uff0c\u6211\u4eec\u60f3\u8981\u4e86\u89e3\u516c\u5f00\u7684\u65b9\u6cd5\u3002<br \/>\n\u4f5c\u4e3a\u4f7f\u7528\u7c7b\u7684\u7acb\u573a\uff0c\u6211\u4eec\u5e76\u4e0d\u9700\u8981\u4e86\u89e3\u5185\u90e8\u5904\u7406\u4f7f\u7528\u7684\u5b57\u6bb5\uff0c\u56e0\u6b64\u5e94\u8be5\u5728\u6700\u540e\u8fdb\u884c\u63cf\u8ff0\u3002<br \/>\n\u516c\u5f00\u7684\u53d8\u91cf\u548c\u5e38\u91cf\u5e94\u8be5\u5728\u5f00\u5934\u8fdb\u884c\u63cf\u8ff0\uff0c\u4f46\u79c1\u6709\u7684\u5e38\u91cf\u6700\u597d\u5728\u6700\u540e\u8fdb\u884c\u63cf\u8ff0\u3002<\/p>\n<h3>\u53ea\u5728\u9700\u8981\u7684\u65f6\u5019\u7ed9\u7c7b\u52a0\u4e0apublic\u3002\u660e\u663e\u5728\u81ea\u5df1\u7684\u5305\u5916\u88ab\u5f15\u7528\u7684\u4e1c\u897f\u5e94\u8be5\u8bbe\u4e3apublic\u3002<br \/>\n\u5176\u4ed6\u7684\u7c7b\u4e0d\u5e94\u8be5\uff08\u6682\u65f6\uff09\u8bbe\u4e3apublic\u3002<br \/>\n\u5982\u679c\u9700\u8981\u7684\u8bdd\uff0c\u53ef\u4ee5\u5728\u90a3\u4e2a\u65f6\u5019\u8bbe\u4e3apublic\uff0c\u4f46\u8fd9\u65f6\u5019\u4f1a\u51fa\u73b0\u201c\u8fd9\u4e2a\u5e94\u8be5\u8bbe\u4e3apublic\u5417\uff1f\u201d\u7684\u601d\u8003\u65f6\u673a\u3002<br \/>\n\u95ee\u9898\u5728\u4e8e\uff0c\u5176\u4ed6\u5305\u7684\u8d23\u4efb\u4eba\u53ef\u80fd\u4f1a\u5728\u4e0d\u77e5\u9053\u53ef\u7528\u7684\u7c7b\u7684\u60c5\u51b5\u4e0b\u521b\u5efa\u7c7b\u4f3c\u7684\u7c7b\u3002<\/p>\n<h3>\u5728\u6784\u9020\u51fd\u6570\u4e2d\uff0c\u4ec5\u8fdb\u884c\u5b57\u6bb5\u521d\u59cb\u5316\uff0c\u800c\u4e0d\u6267\u884c\u5b9e\u8d28\u6027\u7684\u5904\u7406\u3002\u6216\u8bb8\u4e0d\u662f\u5fc5\u987b\u7684\uff0c\u4f46\u5e94\u8be5\u662f\u5e38\u8bc6\u3002<br \/>\n\u666e\u901a\u6784\u9020\u51fd\u6570\u901a\u5e38\u4e0d\u4f1a\u6dfb\u52a0\u592a\u591a\u5904\u7406\uff0c\u5982\u679c\u6dfb\u52a0\u4e86\u5176\u4ed6\u5904\u7406\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u4ed6\u4eba\u8bef\u89e3\u3002<\/p>\n<h3>\u5c06\u5b57\u6bb5\u521d\u59cb\u5316\u7684\u65b9\u6cd5\u8bbe\u4e3afinal\u3002\u9886\u57df\u4e0d\u5728\u58f0\u660e\u884c\u4e2d\u521d\u59cb\u5316\uff0c\u800c\u662f\u5728\u521d\u59cb\u5316\u65b9\u6cd5\u4e2d\u8fdb\u884c\u3002<br \/>\n\u8fd9\u6837\u80fd\u66f4\u6e05\u695a\u5730\u77e5\u9053\u6b63\u5728\u521d\u59cb\u5316\u4ec0\u4e48\u3002<br \/>\n\u5f53\u9700\u8981\u91cd\u65b0\u521d\u59cb\u5316\u65f6\u5f88\u65b9\u4fbf\u3002<br \/>\n\u5c06\u5176\u8bbe\u7f6e\u4e3afinal\u662f\u4e3a\u4e86\u9632\u6b62\u91cd\u5199\u3002\u5728\u6784\u9020\u51fd\u6570\u4e2d\u8c03\u7528\u7684\u65b9\u6cd5\u88ab\u91cd\u5199\u4f1a\u51fa\u95ee\u9898\u3002\u8be6\u7ec6\u7701\u7565\u3002<br \/>\n\u6ce8\u610f\uff0c\u9700\u8981\u53e6\u5916\u8003\u8651\u7ee7\u627f\u7c7b\u7684\u521d\u59cb\u5316\u65b9\u6cd5\u7684\u540d\u79f0\u3002<\/p>\n<h3>\u5728\u7cfb\u7edf\u4e2d\u7edf\u4e00\u547d\u540d\u5b57\u6bb5\u7684\u521d\u59cb\u5316\u65b9\u6cd5\uff08\u4f8b\u5982init\u7b49\uff09\u4e3a\u4e86\u907f\u514d\u8bef\u89e3\uff0c\u5f53\u7136\u8981\u907f\u514d\u7ed9\u5176\u4ed6\u76ee\u7684\u7684\u65b9\u6cd5\u8d77\u4e0e\u521d\u59cb\u5316\u65b9\u6cd5\u76f8\u540c\u7684\u540d\u5b57\u3002<\/p>\n<h3>\u5f53\u5728\u6784\u9020\u51fd\u6570\u6216\u65b9\u6cd5\u4e2d\u6ca1\u6709\u5904\u7406\u65f6\uff0c\u53ef\u4ee5\u5199\u4e0a&#8221;\u65e0\u64cd\u4f5c&#8221;\u3002\u6784\u9020\u51fd\u6570<br \/>\n\u5f53\u6ca1\u6709\u5904\u7406\u65f6\uff0c\u660e\u786e\u8868\u793a\u8fd9\u4e00\u70b9\u662f\u6b63\u786e\u7684\u3002<br \/>\n\u7136\u800c\uff0c\u5982\u679c\u5b57\u6bb5\u7684\u521d\u59cb\u5316\u5df2\u88ab\u65b9\u6cd5\u5316\uff0c\u90a3\u4e48\u5e94\u8be5\u6709\u4e00\u4e9b\u5904\u7406\u3002<br \/>\n\u7ee7\u627f\u7684\u7c7b\u7684\u6784\u9020\u51fd\u6570\u53ef\u80fd\u6ca1\u6709\u5904\u7406\u3002<br \/>\n\u53ef\u4ee5\u770b\u51fa\uff0c\u201c\u5728\u8003\u8651\u662f\u5426\u9700\u8981\u5904\u7406\u4e4b\u540e\uff0c\u5224\u65ad\u662f\u4e0d\u9700\u8981\u5904\u7406\u7684\u201d\u3002<\/p>\n<p>\u65b9\u6cd5<br \/>\n\u53ef\u80fd\u5b58\u5728\u6ca1\u6709\u5904\u7406\u7684\u65b9\u6cd5\u5417\uff1f\u21d2\u5728\u91cd\u5199\u65b9\u6cd5\u7684\u60c5\u51b5\u4e0b\u662f\u53ef\u80fd\u5b58\u5728\u7684\u3002<br \/>\n\u5c06\u5176\u6807\u6ce8\u4e3a\u201c\u6ca1\u6709\u5904\u7406\u201d\u21d2\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5c06\u5176\u63cf\u8ff0\u51fa\u6765\u662f\u5f88\u91cd\u8981\u7684\u3002<br \/>\n\u53ef\u4ee5\u77e5\u9053\u662f\u5728\u8003\u8651\u4e86\u662f\u5426\u9700\u8981\u5904\u7406\u4e4b\u540e\uff0c\u5224\u65ad\u4e0d\u9700\u8981\u5904\u7406\u3002<\/p>\n<h3>\u521b\u5efa\u4e00\u4e2aComparator\u7684\u5b9e\u4f8b\u7c7b\u3002\u867d\u7136\u5f88\u591a\u60c5\u51b5\u4e0b\u5e76\u4e0d\u9700\u8981\uff0c\u4f46\u603b\u4e4b\u8fd8\u662f\u539f\u5219\u4e0a&#8221;\u8fdb\u884c\u521b\u5efa&#8221;\u3002<br \/>\n\u5982\u679c\u4e2a\u522b\u5224\u65ad\u8ba4\u4e3a&#8221;\u5728\u8fd9\u4e2a\u7c7b\u4e2d\u662f\u4e0d\u5fc5\u8981\u7684&#8221;\uff0c\u4e5f\u53ef\u4ee5\u3002<\/p>\n<h3>\u5728\u591a\u4e2a\u903b\u8f91\u7c7b\u4e2d\u4f7f\u7528\u7684\u5b9e\u4f8b\u7c7b\u4e5f\u53ef\u4ee5\u8003\u8651\u5c06\u63a5\u53e3\u5206\u79bb\u3002\u8003\u8651\u5c06\u64cd\u4f5c\u903b\u8f91\u7c7b\u901a\u8fc7\u63a5\u53e3\u4f20\u9012\u7ed9\u5176\u4ed6\u7c7b\u3002<br \/>\n\u4e0d\u8ba9\u4f20\u9012\u7684\u7c7b\u505a\u4efb\u4f55\u81ea\u4e3b\u51b3\u7b56\u3002<br \/>\n\u660e\u786e\u4f20\u9012\u7684\u7c7b\u5e94\u8be5\u505a\u4e9b\u4ec0\u4e48\u3002<br \/>\n\u4e3a\u4e86\u8fd9\u4e2a\u76ee\u7684\uff0c\u521b\u5efa\u4e00\u4e2a\u63a5\u53e3\u53ef\u80fd\u662f\u4e00\u4e2a\u597d\u9009\u62e9\u3002<\/p>\n<h3>\u4e0d\u8981\u521b\u5efa\u53ea\u5305\u542b\u5e38\u91cf\u7684\u63a5\u53e3\u21d2\u6539\u4e3a\u7c7b\u21d2\u4e0d\u53ef\u77e5\u662f\u5426implements\u539f\u56e0\u5982\u4e0a\u6240\u8ff0\u3002\u5982\u679c\u662f\u5728\u7c7b\u4e2d\uff0c\u5219\u5199\u51fa\u7c7b\u540d\u79f0\uff0c\u8fd9\u6837\u53ef\u4ee5\u6e05\u695a\u5730\u4e86\u89e3\u662f\u54ea\u4e2a\u5e38\u91cf\uff0c\u4ee5\u53ca\u5728\u54ea\u91cc\u5b9a\u4e49\u3002<\/p>\n<h3>\u5982\u679c\u5728\u9759\u6001\u4ee3\u7801\u5757\u4e2d\u4e0d\u5f97\u4e0d\u5f15\u53d1\u5f02\u5e38\u21d2\u8bb0\u5f55\u65e5\u5fd7\u548c\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u662f\u4e00\u4e2a\u76f8\u5f53\u7279\u6b8a\u7684\u60c5\u51b5\u3002<br \/>\n\u5728\u5171\u901a\u7c7b\u4e2d\u6709\u4e00\u4e2a\u9759\u6001\u5e38\u91cf\uff0c\u4f7f\u7528\u9759\u6001\u4ee3\u7801\u5757\u6765\u521d\u59cb\u5316\u5b83\u4f1a\u5f88\u65b9\u4fbf\u3002<br \/>\n\u56e0\u4e3a\u5b83\u4f1a\u5728\u7b2c\u4e00\u6b21\u4f7f\u7528\u65f6\u6267\u884c\uff0c\u6240\u4ee5\u4e0d\u9700\u8981\u8003\u8651\u6267\u884c\u65f6\u673a\u7684\u95ee\u9898\u3002<br \/>\n\u7136\u800c\uff0c\u9759\u6001\u4ee3\u7801\u5757\u4e0d\u80fd\u629b\u51fa\u5f02\u5e38\uff08\u4f1a\u5bfc\u81f4\u7f16\u8bd1\u9519\u8bef\uff09\u3002<br \/>\n\u5982\u679c\u5728\u9759\u6001\u4ee3\u7801\u5757\u4e2d\u786e\u5b9e\u5b58\u5728\u5f02\u5e38\uff0c\u53ef\u4ee5\u5728\u5185\u90e8\u8fdb\u884c\u6355\u83b7\uff0c\u7136\u540e\u8f93\u51fa\u65e5\u5fd7\u5e76\u629b\u51fa RuntimeException\uff0c\u8fd9\u6837\u5c31\u80fd\u901a\u8fc7\u7f16\u8bd1\u4e86\u3002<\/p>\n<h3>\u6839\u636e\u9700\u8981\uff0c\u5728\u7c7b\u5185\u521b\u5efa\u5c40\u90e8\u7c7b\u3002\u90a3\u4e9b\u5728\u5176\u4ed6\u5730\u65b9\u4e0d\u4f1a\u88ab\u4f7f\u7528\u7684\u8bfe\u7a0b\u5e94\u8be5\u5728\u672c\u5730\u5b9a\u4e49\u3002<br \/>\n\u5c06\u5176\u66b4\u9732\u5728\u5916\u4f1a\u8ba9\u4eba\u8ba8\u538c\uff0c\u5bb9\u6613\u5f15\u8d77\u8bef\u89e3\u3002<br \/>\n\u5c06\u53d8\u91cf\u5c3d\u53ef\u80fd\u5730\u9650\u5236\u5728\u4e00\u4e2a\u5c0f\u8303\u56f4\u5185\u540c\u6837\u9002\u7528\u3002<\/p>\n<h2>\u5b9e\u73b0\u548c\u7ee7\u627f<\/p>\n<h3>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u201cDummy\u201d\u7684\u865a\u62df\u5e93\u63a5\u53e3\uff08\u5982Comparator\u3001Iterator\u7b49\uff09\uff0c\u7136\u540e\u4f7f\u7528\u5b83\u3002\u539f\u56e0\u5728\u4e8e\uff0c\u901a\u8fc7JavaDoc\u53ef\u4ee5\u7acb\u5373\u4e86\u89e3Comparator\u7684\u5217\u8868\u3002<\/p>\n<p>\/\/ \u8fd9\u6837\u505a\u3002<br \/>\ninterface \u6211\u4eec\u7684\u6bd4\u8f83\u5668 extends Comparator {}<br \/>\nclass \u6211\u4eec\u7684\u7c7b implements \u6211\u4eec\u7684\u6bd4\u8f83\u5668 { &#8230;. }<\/p>\n<h3>\u5728\u5b9e\u73b0\u548c\u7ee7\u627f\u4e2d\uff0c\u5c06\u539f\u59cb\u540d\u79f0\u524d\u52a0\u4e0a\u524d\u7f00\u7684\u540d\u79f0\u3002\u4ee5\u4e0b\u662f\u7406\u7531:<br \/>\n\u53ef\u4ee5\u7acb\u5373\u77e5\u9053\u540d\u5b57\u4ee3\u8868\u4ec0\u4e48\u5b9e\u73b0\u548c\u7ee7\u627f<br \/>\n\u5728Eclipse\u4e2d\u4f1a\u663e\u793a\u5728\u65c1\u8fb9\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u65b9\u5f0f\u6765\u5b9e\u73b0\u3002<br \/>\n\/** \u5458\u5de5\u7c7b *\/<br \/>\nclass \u5458\u5de5 {}<br \/>\n\/* \u7ba1\u7406\u804c\u4f4d\u7c7b *\/<br \/>\nclass \u7ba1\u7406\u804c\u4f4d extends \u5458\u5de5 {}<\/p>\n<p>\u554f\u984c\u9ede<br \/>\n\u9019\u500b\u540d\u7a31\u5728\u82f1\u6587\u4e2d\u4e0d\u592a\u5408\u9069\u3002<br \/>\n\u7576\u5b58\u5728\u591a\u500b\u5be6\u73fe\u548c\u7e7c\u627f\u6642\uff0c\u9700\u8981\u9650\u5b9a\u4e00\u500b\u3002<br \/>\n\u5982\u679c\u5c64\u6b21\u8b8a\u6210\u591a\u500b\uff0c\u540d\u7a31\u5c07\u9010\u6f38\u8b8a\u9577\u3002<\/p>\n<h3>\u5f53\u4e0d\u5e0c\u671b\u4f7f\u7528\u57fa\u7c7b\u65b9\u6cd5\u65f6\uff0c\u5c06\u5176\u8bbe\u4e3aRuntimeException\u3002\u521b\u5efa\u6d3e\u751f\u7c7b\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u57fa\u7c7b\u65b9\u6cd5\u4e0d\u518d\u9700\u8981\u7684\u60c5\u51b5\u3002\u901a\u8fc7\u8986\u76d6\u8fd9\u4e2a\u65b9\u6cd5\u5e76\u5f15\u53d1RuntimeException\uff0c\u53ef\u4ee5\u9632\u6b62\u9519\u8bef\u7684\u8c03\u7528\u3002<\/p>\n<h3>\u5728\u7c7b\u5b9a\u4e49\u548c\u65b9\u6cd5\u4e2d\uff0c\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u4f7f\u7528final\u5173\u952e\u5b57\u3002\u8fd9\u662f\u5e38\u8bc6\uff0c\u4f46\u4f3c\u4e4e\u5f88\u5c11\u6709\u4eba\u5b9e\u8df5\u3002\u6211\u4e5f\u662f\u8fd9\u6837\u3002<br \/>\n\u6240\u4ee5\u6700\u597d\u5c06\u5176\u5236\u5b9a\u4e3a\u89c4\u5219\uff0c\u4ee5\u514d\u5fd8\u8bb0\u3002<\/p>\n<h3>\u5b9e\u4f8b\u7c7b\u8981\u5b9e\u73b0toString\u65b9\u6cd5\u3002\u7531\u4e8e\u5bf9\u8c03\u8bd5\u7b49\u5de5\u4f5c\u975e\u5e38\u6709\u7528\uff0c\u6240\u4ee5\u4e00\u5b9a\u8981\u5b9e\u73b0\u3002<br \/>\n\u53ea\u9700\u5c06\u6240\u9700\u5b57\u6bb5toString\u5e76\u8fde\u63a5\u8d77\u6765\uff0c\u5c31\u80fd\u521b\u5efa\u901a\u7528\u7684\u8f85\u52a9\u5de5\u5177\u3002<\/p>\n<h3>\u5b9e\u4f8b\u7c7b\u9700\u8981\u5b9e\u73b0equals\u3001hashCode\u3001Comparable\u548cclone\u3002\u5728\u8fd9\u4e9b\u4e2d\u6709\u5f88\u591a\u662f\u4e0d\u5fc5\u8981\u7684\u3002<br \/>\n\u5c06\u5176\u89c4\u5b9a\u4e3a\u5b9e\u73b0\u7684\u89c4\u5219\uff0c\u7136\u540e\u9488\u5bf9\u201c\u8fd9\u4e2a\u7c7b\u4e0d\u9700\u8981\u5b9e\u73b0\u201d\u7684\u60c5\u51b5\u8fdb\u884c\u4e2a\u522b\u5224\u65ad\u3002<\/p>\n<p>## \u65b9\u6cd5<\/p>\n<h3>\u5728\u65b9\u6cd5\u7684\u540d\u79f0\u4e2d\u4e0d\u4f7f\u7528\u5426\u5b9a\u5f62\u7279\u522b\u662f\u5bf9\u4e8e\u8fd4\u56de\u503c\u4e3a\u5e03\u5c14\u7c7b\u578b\u7684\u60c5\u51b5\u3002<br \/>\n\u4f7f\u7528\u4e0e\u5e03\u5c14\u53d8\u91cf\u540c\u540d\u7684\u53d8\u91cf\u540d\u53ef\u80fd\u4f1a\u8ba9\u4eba\u96be\u4ee5\u7406\u89e3\u3002<br \/>\n\u867d\u7136\u6709\u65f6\u5e76\u4e0d\u96be\u4ee5\u7406\u89e3\uff0c\u4f46\u4ecd\u9700\u8981\u4e2a\u522b\u5224\u65ad\u6765\u786e\u5b9a\u3002<\/p>\n<h3>\u8fd4\u56de\u503c\u4e3aList\u7b49\u65f6\uff0c\u82e5\u65e0\u503c\uff0c\u5219\u8fd4\u56denull\u6bd4\u8fd4\u56de\u7a7a\uff08\u5927\u5c0f\u4e3a\u96f6\uff09\u66f4\u4e3a\u5e38\u89c1\u3002<br \/>\n\u5982\u679c\u4e3a\u7a7a\uff0c\u53ef\u4ee5\u5c06\u6570\u636e\u53ef\u53d6\u4e0e\u6570\u636e\u4e0d\u53ef\u53d6\u65f6\u7684\u5904\u7406\u65b9\u5f0f\u76f8\u540c\u3002\u8fd9\u662f\u5b83\u7684\u4f18\u70b9\u3002<\/p>\n<p>\u7136\u800c\uff0c\u4e5f\u53ef\u4ee5\u8bf4\u9700\u8981\u660e\u786e\u5224\u65ad\u624d\u66f4\u597d\u3002<br \/>\n\u5173\u4e8e\u9009\u62e9\u54ea\u4e00\u4e2a\uff0c\u6211\u4eec\u53ef\u4ee5\u7edf\u4e00\u901a\u8fc7\u7cfb\u7edf\u6765\u51b3\u5b9a\u3002<br \/>\n\u8bf7\u53c2\u9605&#8221;\u5728\u539f\u6765\u7684\u7c7b\u4e2d\u521b\u5efa\u4e00\u4e2a\u5224\u65ad\u8fd4\u56de\u503c\u662f\u5426\u6b63\u5e38\u7684\u9759\u6001\u65b9\u6cd5&#8221;\u3002<\/p>\n<h3>\u5728\u539f\u59cb\u7c7b\u4e2d\u521b\u5efa\u4e00\u4e2a\u9759\u6001\u65b9\u6cd5\u6765\u5224\u65ad\u8fd4\u56de\u503c\u662f\u5426\u6b63\u5e38\u3002\u5f53\u8fd4\u56de\u503c\u88ab\u8fd4\u56de\u540e\uff0c\u63a5\u4e0b\u6765\u7684\u5904\u7406\u5c06\u7531\u8c03\u7528\u65b9\u81ea\u884c\u51b3\u5b9a\u3002<br \/>\n\u65e0\u6cd5\u786e\u5b9a\u662f\u5426\u4f1a\u6309\u7167\u65b9\u6cd5\u7684\u672c\u610f\u8fdb\u884c\u89e3\u91ca\u3002<\/p>\n<p>\u4e3a\u4e86\u5c3d\u53ef\u80fd\u6539\u5584\uff0c\u8bf7\u6309\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c\uff1a<br \/>\n\u7c7b\u540d\u4e3aMyClass\u7684\u7c7b\uff1a<br \/>\n\/** \u8c03\u7528\u65b9\u6cd5 **\/<br \/>\npublic String method(String str) {<br \/>\n\/\/ \u5177\u4f53\u64cd\u4f5c<br \/>\nreturn null; \/\/ \u53d1\u751f\u9519\u8bef<br \/>\n}<\/p>\n<p>\/* \u5224\u65ad\u8fd4\u56de\u503c\u7684\u65b9\u6cd5 *\/<br \/>\npublic static boolean errorHappened(String value) {<br \/>\nreturn (value == null);<br \/>\n}<\/p>\n<p>MyClass myObj = new MyClass();<br \/>\nString returnValue = myObj.method(&#8220;aaaa&#8221;);<br \/>\nif (MyClass.errorHappened(returnValue)) {<br \/>\n\/\/ \u9519\u8bef\u5904\u7406<br \/>\n}<\/p>\n<p>\u6211\u77e5\u9053\u6709\u4eba\u6279\u8bc4\u8bf4\u300c\u8fc7\u706b\u300d\u3002<\/p>\n<h3>\u628a\u8fd4\u56de\u503c\u4e3a\u5e03\u5c14\u7c7b\u578b\u7684\u65b9\u6cd5\u547d\u540d\u4e3a\u9002\u5e94if\u8bed\u53e5\u7684\u540d\u79f0\u3002\u7c7b MyClass {<br \/>\npublic boolean check(String str) {<br \/>\n\/\/ \u8fdb\u884c\u67d0\u4e9b\u64cd\u4f5c<br \/>\nreturn true;<br \/>\n}<br \/>\npublic boolean checkNormalEnded(String str) {<br \/>\n\/\/ \u8fdb\u884c\u67d0\u4e9b\u64cd\u4f5c<br \/>\nreturn true;<br \/>\n}<br \/>\n}<\/p>\n<p>MyClass myObj = new MyClass();<br \/>\n\/\/ \u8fd9\u6837\u7684\u8bdd\uff0c\u6211\u4e0d\u592a\u660e\u767d if \u8bed\u53e5\u7684\u610f\u601d<br \/>\nif (myObj.check(&#8220;aaaa&#8221;)) {<br \/>\n\/\/ \u8fdb\u884c\u67d0\u4e9b\u5904\u7406<\/p>\n<p>\u5982\u679c\u6211\u7684\u5bf9\u8c61\u68c0\u67e5\u6b63\u5e38\u7ed3\u675f\uff0c\u5e76\u4e14\u7406\u89e3\u4e86\u8fd9\u4e00\u70b9\uff0c<br \/>\nif (myObj.checkNormalEnded(&#8220;aaaa&#8221;)) {<br \/>\n\/\/ \u8fdb\u884c\u4e00\u4e9b\u5904\u7406<br \/>\n}<\/p>\n<h3>\u5728\u8fd4\u56de\u503c\u4e2d\u4e0d\u8981\u4f7f\u7528\u5185\u90e8\u5bf9\u8c61\u7684List, Set, Map\u7b49\uff0c\u5982\u679c\u9700\u8981\u7684\u8bdd\uff0c\u5e94\u8fd4\u56de\u5176\u526f\u672c\u3002\u5982\u679c\u8fd4\u56de\u5185\u90e8\u7684List\u7b49\uff0c\u6709\u53ef\u80fd\u4f1a\u88ab\u4efb\u610f\u4fee\u6539\uff0c\u6240\u4ee5\u9009\u62e9\u590d\u5236\u5e76\u8fd4\u56de\u4e00\u4e2a\u526f\u672c\u3002\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0cArrayList\u53ef\u4ee5\u514b\u9686\uff0c\u4f46\u662fList\u4e0d\u53ef\u4ee5\u514b\u9686\u3002<\/p>\n<h3>\u60f3\u8981\u8fd4\u56de\u591a\u4e2a\u503c\u65f6\u8be5\u600e\u4e48\u505a\uff1f\u21d2\u521b\u5efa\u4e00\u4e2a\u7c7b\u521b\u5efa\u4e00\u4e2a\u7528\u4e8e\u8fd4\u56de\u503c\u7684\u7c7b\u3002<br \/>\n\u4f46\u662f\u5982\u679c\u8fd9\u4e2a\u7c7b\u5728\u5176\u4ed6\u5730\u65b9\u65e0\u6cd5\u4f7f\u7528\uff0c\u90a3\u5c06\u975e\u5e38\u4ee4\u4eba\u61ca\u6094\u3002<br \/>\n\u4e0d\u8fc7\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u4f1a\u5fcd\u53d7\u61ca\u6094\uff0c\u5e76\u91c7\u53d6\u8fd9\u79cd\u505a\u6cd5\u3002<\/p>\n<h3>\u5f53\u60f3\u8981\u8fd4\u56de\u591a\u4e2a\u8fd4\u56de\u503c\u65f6\u5e94\u8be5\u600e\u4e48\u505a\uff1f\u2013 \u8fd4\u56de\u5bf9\u8c61\u6570\u7ec4 \u2013 \u521b\u5efa\u4e00\u4e2a\u7528\u4e8e\u63d0\u53d6\u503c\u7684\u9759\u6001\u65b9\u6cd5\u3002\/\/ \u5982\u679c\u4f60\u7edd\u5bf9\u4e0d\u559c\u6b22\u524d\u8ff0\u60c5\u51b5\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c\u64cd\u4f5c<br \/>\nclass Box {<br \/>\npublic Object[] getSize() {<br \/>\n\/\/ \u7b2c\u4e00\u4e2a\u5143\u7d20\u4ee3\u8868\u9ad8\u5ea6\uff0c\u7b2c\u4e8c\u4e2a\u5143\u7d20\u4ee3\u8868\u5bbd\u5ea6<br \/>\nreturn new Integer[]{5, 10};<br \/>\n}<br \/>\npublic static Integer getHeight(Object[] values) {<br \/>\nreturn (Integer)values[0];<br \/>\n}<br \/>\npublic static Integer getWidth(Object[] values) {<br \/>\nreturn (Integer)values[1];<br \/>\n}<br \/>\n}<\/p>\n<p>Box box = new Box();<br \/>\nObject[] values = box.getSize();<br \/>\nint width = Box.getWidth(values);<br \/>\nint height = Box.getHeight(values);<\/p>\n<p>\u7bb1\u5b50 box = new \u7bb1\u5b50();<br \/>\n\u7269\u4f53[] values = box.\u5927\u5c0f();<br \/>\nint \u5bbd\u5ea6 = \u7bb1\u5b50.\u5bbd\u5ea6(values);<br \/>\nint \u9ad8\u5ea6 = \u7bb1\u5b50.\u9ad8\u5ea6(values);<\/p>\n<h3>\u4e0d\u9700\u8981\u7684\u5185\u90e8\u6570\u636e\u7684\u65b9\u6cd5\u5e94\u8be5\u8bbe\u4e3a\u9759\u6001\u3002\u4e0d\u9700\u8981\u8fdb\u884cnew\u64cd\u4f5c\uff0c\u53ea\u9700\u5199\u51fa\u7c7b\u540d\u5c31\u80fd\u6e05\u6670\u7406\u89e3\u5176\u610f\u601d\u3002<br \/>\n\u6211\u8ba4\u4e3a\u8fd9\u6837\u505a\u5f88\u5e38\u89c1\uff0c\u4f46\u6709\u65f6\u4f1a\u770b\u5230\u5c06\u5176\u8bbe\u4e3a\u5b9e\u4f8b\u65b9\u6cd5\u3002<\/p>\n<h3>\u5c3d\u91cf\u907f\u514d\u8fc7\u8f7d\uff0c\u4ee5\u4fbf\u4f7f\u4ee3\u7801\u66f4\u52a0\u6613\u61c2\u3002, sh\u01d0 y\u00ec .)<\/p>\n<p>\u5982\u679c\u68c0\u67e5\u53c2\u6570\u5c31\u80fd\u533a\u5206\uff0c\u4f46\u5f88\u9ebb\u70e6\uff0c\u5e94\u8be5\u901a\u8fc7\u65b9\u6cd5\u540d\u79f0\u8fdb\u884c\u533a\u5206<\/p>\n<h2>\u903b\u8f91<\/p>\n<h3>\u5728\u7f16\u7a0b\u65f6\uff0c\u6ce8\u91cd\u6613\u7406\u89e3\u6027\u800c\u4e0d\u662f\u5904\u7406\u901f\u5ea6\u3002\u5982\u679c\u9700\u8981\u901f\u5ea6\uff0c\u5c31\u8fd9\u6837\u505a\u3002\u73b0\u5728\u8fd9\u4e00\u8ba4\u8bc6\u88ab\u89c6\u4e3a\u7406\u6240\u5f53\u7136\u3002<\/p>\n<h3>\u5982\u679c\u4f60\u89c9\u5f97\u903b\u8f91\u5f88\u201c\u96be\u3001\u590d\u6742\u201d\uff0c\u5c31\u8981\u91cd\u65b0\u601d\u8003\u4e00\u6b21\u3002 n\u01d0 &#8220;, &#8220;, .)\u8003\u8651\u4ee5\u4e0b\u4e8b\u9879\uff1a<br \/>\n\u6709\u6ca1\u6709\u66f4\u7b80\u5355\u7684\u903b\u8f91\uff1f<br \/>\n\u601d\u8003\u65b9\u5f0f\u662f\u5426\u6b63\u786e\uff1f<br \/>\n\u672c\u6765\u9700\u8981\u7684\u903b\u8f91\u5417\uff1f<br \/>\n\u5982\u679c\u4ecd\u7136\u9700\u8981\uff0c\u90a3\u5c31\u575a\u6301\u53bb\u505a\uff01<\/p>\n<h3>\u8fdb\u884c\u6574\u7406\u7684\u5904\u7406\u88ab\u5206\u7ec4\u4e3a\u4e00\u4e2a\u5757\u4e3a\u4e86\u5b9e\u73b0\u4e00\u4e2a\u64cd\u4f5c\uff0c\u6709\u65f6\u9700\u8981\u7f16\u5199\u591a\u884c\u4ee3\u7801\u3002\u4f8b\u5982\uff0c\u5c06\u503c\u8d4b\u7ed9\u4e00\u4e9b\u53d8\u91cf\u5e76\u8c03\u7528\u65b9\u6cd5\u7b49\u3002<br \/>\n\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5c06\u8fd9\u4e9b\u4e00\u7cfb\u5217\u7684\u4ee3\u7801\u884c\u7ec4\u5408\u6210\u4e00\u4e2a\u4ee3\u7801\u5757\uff0c\u5e76\u5c06\u7f29\u8fdb\u51cf\u5c11\u4e00\u7ea7\u3002<br \/>\n\u901a\u8fc7\u5c06\u5176\u53d8\u4e3a\u4ee3\u7801\u5757\uff0c\u53ef\u4ee5\u770b\u51fa\u8fd9\u4e9b\u884c\u662f\u4e00\u7cfb\u5217\u76f8\u5173\u7684\u64cd\u4f5c\u3002<br \/>\n\u53ef\u4ee5\u7ed9\u6574\u4e2a\u4ee3\u7801\u5757\u6dfb\u52a0\u6ce8\u91ca\u3002<br \/>\n\u7531\u4e8e\u53ef\u4ee5\u5728\u4ee3\u7801\u5757\u5185\u90e8\u5b9a\u4e49\u53d8\u91cf\uff0c\u53ef\u4ee5\u9632\u6b62\u53d8\u91cf\u7684\u8bef\u64cd\u4f5c\u3002<\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u5173\u4e8e\u6574\u4e2a\u4ee3\u7801\u5757\u7684\u6ce8\u91ca\uff0c\u5728\u4ee3\u7801\u5757\u5185\u90e8\u5199\u4e0b\u4e00\u7cfb\u5217\u7684\u64cd\u4f5c\uff1a<br \/>\n{<br \/>\nint a = 0;<br \/>\nString str = &#8220;abc&#8221;;<br \/>\n\/\/ \u63a5\u4e0b\u6765\u662f\u5176\u4ed6\u64cd\u4f5c.<br \/>\n}<\/p>\n<h3>\u5728else\u8bed\u53e5\u4e2d\u8fdb\u884c\u6362\u884c\u3002\u5f88\u591a\u4eba\u4f1a\u50cf\u8fd9\u6837\u7f16\u5199if-else\u8bed\u53e5\uff1a<br \/>\nint a = 1;<br \/>\nif (a == 1) {<br \/>\n\/\/ \u9700\u8981\u6267\u884c\u7684\u64cd\u4f5c<br \/>\n} else {<br \/>\n\/\/ \u53e6\u4e00\u79cd\u64cd\u4f5c<br \/>\n}<\/p>\n<p>\u5c06\u5176\u63cf\u8ff0\u4e3a\u4e0b\u9762\u8fd9\u6837\u7684\u539f\u56e0\u662f\u53ef\u4ee5\u5728\u6574\u4e2aelse\u90e8\u5206\u6dfb\u52a0\u6ce8\u91ca\u3002\u8bf7\u53c2\u8003\u4e0a\u9762\u7684&#8221;\u5c06\u91cd\u590d\u7684\u5904\u7406\u653e\u5165\u5757\u4e2d&#8221;\u3002<\/p>\n<p>\u5982\u679c (a == 1) {<br \/>\n\/\/ \u9700\u8981\u6267\u884c\u7684\u64cd\u4f5c<br \/>\n}<br \/>\n\/\/ \u5982\u679c\u4e0d\u6ee1\u8db3\u6761\u4ef6\u65f6\u7684\u64cd\u4f5c\u21d2\u8fd9\u662felse\u7684\u6574\u4e2a\u6ce8\u91ca<br \/>\n\u5426\u5219 {<br \/>\n\/\/ \u53e6\u4e00\u79cd\u64cd\u4f5c<br \/>\n}<\/p>\n<h3>\u4f7f\u7528\u4e09\u4e2a\u8fd0\u7b97\u7b26\u8fd9\u662f\u7406\u6240\u5f53\u7136\u7684\uff0c\u6211\u4eec\u7ecf\u5e38\u4f1a\u89c1\u5230\u672a\u4f7f\u7528\u7684\u7a0b\u5e8f\u3002\u884c\u6570\u589e\u591a\uff0c\u5197\u957f\uff0c\u96be\u4ee5\u9605\u8bfb\uff0c\u4ee4\u4eba\u70e6\u8e81\u3002\u4f46\u662f\u4e0d\u4f7f\u7528\u5d4c\u5957\u7684\u4e09\u5143\u8fd0\u7b97\u7b26\u3002<\/p>\n<p>\u5982\u679c\u6ca1\u6709else\u65f6\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e09\u5143\u8fd0\u7b97\u7b26\u6765\u51cf\u5c11\u4ee3\u7801\u884c\u6570\u3002\u4f8b\u5b50\uff1aa = (logic expression) ? a = (algebraic expression) : a;<\/p>\n<h3>\u5982\u679cif\u8bed\u53e5\u7684\u5185\u5bb9\u53ea\u5305\u542b\u4e86break\u3001continue\u3001return\u3001throw\u8fd9\u4e9b\u5173\u952e\u5b57\uff0c\u90a3\u4e48\u53ef\u4ee5\u5c06\u5b83\u4eec\u4e0eif\u8bed\u53e5\u653e\u5728\u540c\u4e00\u884c\u4e0a\u8fdb\u884c\u7f16\u5199\u3002\u5982\u679c\uff08\u6761\u4ef6\uff09{ \u9000\u51fa\u5faa\u73af; }<\/p>\n<p>\u4e3a\u4e86\u51cf\u5c11\u884c\u6570\uff0c\u5c3d\u91cf\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u66f4\u591a\u5185\u5bb9\u7684\u539f\u56e0\u3002<br \/>\n\u5176\u4ed6\u60c5\u51b5\u4e0b\uff0c\u7531\u4e8e\u903b\u8f91\u4f1a\u6df7\u4e71\u5728\u4e0b\u65b9\u6d41\u52a8\uff0c\u6240\u4ee5\u88ab\u7981\u6b62\u3002<\/p>\n<h3>\u5728\u4e2d\u6587\u4e2d\uff0c\u5224\u65adString\u7684\u76f8\u7b49\u6027\u53ef\u4ee5\u4f7f\u7528equals\u65b9\u6cd5\u3002\u6709\u65f6\u5019\u4f1a\u5076\u5c14\u770b\u5230\u4e00\u4e9b\u4ee5\u201c==\u201d\u8fdb\u884c\u5224\u65ad\u7684\u7a0b\u5e8f\u3002\u5982\u679c\u4ed4\u7ec6\u89c2\u5bdf\u5b83\u4eec\uff0c\u53ef\u80fd\u4f1a\u611f\u5230\u5934\u6655\u3002\u800c\u4e14\u6709\u65f6\u8fd9\u4e9b\u7a0b\u5e8f\u8fd8\u80fd\u901a\u8fc7\u6d4b\u8bd5\u3002\u80fd\u901a\u8fc7\u6d4b\u8bd5\u7684\u539f\u56e0\u662f\u56e0\u4e3a\u5b83\u4eec\u5faa\u73af\u590d\u5236\uff0c\u5e76\u4e14\u7ed3\u679c\u76f8\u7b49\u3002<\/p>\n<h3>\u5c06\u5b57\u7b26\u4e32\u7684\u7b49\u503c\u5224\u65ad\u4ee5\u5e38\u6570\u4f5c\u4e3a\u4e3b\u8bed\u3002\u4e3a\u4e86\u9632\u6b62\u51fa\u73b0null\u9519\u8bef\uff0c\u9700\u8981\u8fdb\u884c\u9002\u5f53\u7684null\u68c0\u67e5\u3002\u5f53\u786e\u5b9e\u9700\u8981\u8fdb\u884cnull\u68c0\u67e5\u65f6\uff0c\u9700\u8981\u5728\u524d\u4e00\u884c\u8fdb\u884c\u68c0\u67e5\u3002<\/p>\n<p>\u5b57\u7b26\u4e32 str = &#8220;bbbb&#8221;;<br \/>\nif (&#8220;aaaa&#8221;.equals((str))) { \/\/ \u6ce8\u610f\uff1a\u5b9e\u9645\u4e0a\u5e94\u5c06 &#8220;aaaa&#8221; \u5b9a\u4e49\u4e3a\u5e38\u91cf<br \/>\n\/\/ \u5339\u914d\u65f6\u7684\u5904\u7406<br \/>\n}<\/p>\n<h3>\u5728\u4e2d\u6587\u4e2d\uff0c\u6709\u4e0d\u9700\u8981\u521b\u5efa\u5e03\u5c14\u503c\u5bf9\u8c61\u5728\u4e2d\u56fd\u7684\u539f\u751f\u8bed\u8a00\u4e2d\u8fdb\u884c\u6539\u5199\uff0c\u4ec5\u9700\u7ed9\u51fa\u4e00\u4e2a\u9009\u9879\uff1a<br \/>\nBoolean\u53ea\u80fd\u662ftrue\u3001false\uff08\u548cnull\uff09\uff0c\u5e76\u4e14\u7531Boolean\u7c7b\u5b9a\u4e49\uff0c\u4e0d\u9700\u8981\u8fdb\u884c\u5b9e\u4f8b\u5316\u3002<br \/>\n\u6ce8\u610f\uff0c(new Boolean(true)) == (new Boolean(true))\u4f1a\u8fd4\u56defalse.<\/p>\n<p>\u5e03\u5c14\u503c boolValue = \u5e03\u5c14\u503c.\u771f\u3002<\/p>\n<h3>null\u9700\u8981\u660e\u786e\u7c7b\u578b\u5f53\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf\u65f6\uff0c\u5c3d\u7ba1\u8fd8\u597d\uff0c\u4f46\u5f53\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\u65f6\u5bb9\u6613\u51fa\u9519\u3002<br \/>\n\u8fd9\u4f1a\u5f15\u53d1\u4e0d\u5b89\uff0c\u5e76\u9700\u8981\u67e5\u770b\u5bf9\u65b9\u7684\u65b9\u6cd5\u4ee5\u8fdb\u884c\u786e\u8ba4\u3002<\/p>\n<p>\u7c7bMyClass{<br \/>\npublic void method(String str){<br \/>\n\/\/ \u6267\u884c\u67d0\u4e9b\u64cd\u4f5c<br \/>\n}<br \/>\n}<\/p>\n<p>\u6211\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u5b9e\u73b0\uff1a<br \/>\nMyClass myObj = new MyClass();<br \/>\nmyObj.method((String)null);<\/p>\n<p>\u5b9e\u9645\u4e0a\uff0c\u6700\u597d\u91cd\u65b0\u5b9a\u4e49null\u3002\u8bf7\u53c2\u8003\u201c\u91cd\u65b0\u5b9a\u4e49null\u5e76\u4f7f\u7528\u21d2\u7c7b\u540d+IS_NULL\u201d\u3002<\/p>\n<h3>\u5982\u679c\u3001\u5bf9\u4e8e\u3001\u5f53\u88ab\u89c6\u4f5c\u4e00\u4e2a\u5757\uff0c\u5373\u4f7f\u53ea\u6709\u4e00\u53e5\u8bdd\u4e5f\u662f\u5982\u6b64\u3002\u7406\u7531\u662f\u56e0\u4e3a\u5f53\u8bd5\u56fe\u6dfb\u52a0\u53e5\u5b50\u65f6\u4f1a\u51fa\u73b0\u9519\u8bef\u3002<\/p>\n<h3>\u5728\u9700\u8981\u8003\u8651\u987a\u5e8f\u7684\u5faa\u73af\u4e2d\uff0c\u4e0d\u4f7f\u7528\u589e\u5f3a\u578bfor\u5faa\u73af\u3002\u867d\u7136\u7ed3\u679c\u662f\u76f8\u540c\u7684\uff0c\u4f46\u5728\u6e90\u4ee3\u7801\u4e0a\u770b\u4e0d\u51fa\u662f\u6309\u987a\u5e8f\u8fdb\u884c\u5904\u7406\u3002<\/p>\n<p>\u5982\u679c\u9700\u8981\u5904\u7406\u987a\u5e8f\u53f7\uff0c\u4e0d\u4f7f\u7528\u589e\u5f3a\u578bfor\u5faa\u73af\u662f\u5f88\u81ea\u7136\u7684\u3002\u4f46\u662f\uff0c\u4f8b\u5982\u5728&#8221;\u6309\u8f93\u5165\u987a\u5e8f\u5904\u7406&#8221;\u7684\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u4e0d\u4f7f\u7528\u987a\u5e8f\u53f7\uff0c\u4e5f\u4e0d\u4f7f\u7528\u589e\u5f3a\u578bfor\u5faa\u73af\u3002<\/p>\n<h3>\u8003\u8651\u4f7f\u7528\u5e38\u91cf\u8868\u6765\u5212\u5206\uff0c\u800c\u65e0\u9700\u4f7f\u7528\u5206\u652f(if,switch)\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528if\u8bed\u53e5\u7684\u4f8b\u5b50<br \/>\nint a = 1;<br \/>\nString msg;<br \/>\nif (a == 0) {<br \/>\nmsg = &#8220;aaaa&#8221;;<br \/>\n}<br \/>\nelse if (a == 1) {<br \/>\nmsg = &#8220;bbbb&#8221;;<br \/>\n}<br \/>\n\/\/\u7ee7\u7eed\u8fdb\u884c\u4e0b\u53bb\u3002<\/p>\n<p>\u7528\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c\uff1a<br \/>\nString[] msgs = new String[] {&#8220;aaaa&#8221;,&#8221;bbbb&#8221;};<br \/>\nmsg = msgs[a];<\/p>\n<p>\u8fd9\u4e2a\u4f8b\u5b50\u6ca1\u6709\u4ef7\u503c\uff0c\u4f46\u662f\u5728\u5236\u4f5c\u72b6\u6001\u673a\u7b49\u65f6\uff0c\u5982\u679c\u4e0d\u8fd9\u6837\u505a\u5c31\u4f1a\u6df7\u4e71\u3002\u4f46\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u539f\u59cb\u503c\u4e0d\u662f\u4ece\u96f6\u5f00\u59cb\uff0c\u5c31\u9700\u8981\u5c06\u6570\u7ec4\u8bbe\u4e3a\u4e24\u5c42\u3002\u53ea\u6709\u5e38\u91cf\u8868\uff0c\u6240\u4ee5\u5b83\u4f1a\u53d8\u5f97\u66f4\u77ed\u3001\u66f4\u6613\u8bfb\u21d2\u9519\u8bef\u4f1a\u53d8\u5c11\u3002<\/p>\n<h3>\u5728else\u6761\u4ef6\u4e0b\u6ca1\u6709\u5904\u7406\u65f6\uff0c\u6ce8\u91ca\u4e3a&#8221;\u65e0\u5904\u7406&#8221;\u3002int a = 0;<br \/>\nif (a == 0) {<br \/>\n\/\/ \u5199\u5165\u67d0\u4e9b\u5904\u7406<br \/>\n}<br \/>\nelse {<br \/>\n\/\/ \u4e0d\u8fdb\u884c\u5904\u7406<br \/>\n}<\/p>\n<p>\u5f53\u7136\u5730\uff0c\u5bf9\u4e8e\u6240\u6709\u7684if\u8bed\u53e5\uff0c\u4e0d\u4e00\u5b9a\u8981\u8fd9\u6837\u505a\uff0c\u53ea\u6709\u5f53\u6709\u7591\u95ee\u7684\u7a7a\u95f4\u65f6\u624d\u9700\u8981\u3002<br \/>\n\u8fd9\u53ef\u4ee5\u4f20\u8fbe\u51fa\u201c\u5728\u8003\u8651\u662f\u5426\u9700\u8981else\u5904\u7406\u540e\uff0c\u5224\u65ad\u5b83\u662f\u4e0d\u5fc5\u8981\u7684\u201d\u7684\u610f\u601d\u3002<\/p>\n<h3>\u5c06\u590d\u5408\u6761\u4ef6\u5206\u89e3\u5e76\u5d4c\u5957\u5728if\u8bed\u53e5\u4e2d\u3002\u5728\u4f7f\u7528if\u8bed\u53e5\u65f6\uff0c\u6709\u65f6\u4f1a\u51fa\u73b0\u591a\u4e2a\u6761\u4ef6\u901a\u8fc7&#8221;and&#8221;\u8fde\u63a5\u800c\u53d8\u5f97\u96be\u4ee5\u7406\u89e3\u7684\u60c5\u51b5\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5e94\u5f53\u89e3\u6790\u6761\u4ef6\u5e76\u5c06if\u8bed\u53e5\u8fdb\u884c\u5d4c\u5957\u3002<\/p>\n<p>\u5373\u4f7f\u53d7\u5230&#8221;\u7d20\u4eba&#8221;\u7684\u6279\u8bc4\uff0c\u4e5f\u4e0d\u80fd\u52a8\u6447\u3002\u91cd\u8981\u7684\u662f\u907f\u514dbug\uff0c\u5e76\u4e14\u6ce8\u91cd\u4f7f\u4ee3\u7801\u66f4\u6613\u7406\u89e3\u3002<\/p>\n<h3>\u5c06\u590d\u5408\u6761\u4ef6\u7528\u62ec\u53f7\u5206\u9694\u5e76\u660e\u786e\u8868\u793a\u3002\u5f53\u591a\u4e2a\u6761\u4ef6\u901a\u8fc7and\/or\u8fde\u63a5\u5728\u4e00\u8d77\u65f6\uff0c\u5982\u679c\u7528\u62ec\u53f7()\u5c06\u5b83\u4eec\u5206\u9694\u5f00\u6765\uff0c\u4f1a\u66f4\u5bb9\u6613\u9605\u8bfb\u3002<\/p>\n<h3>\u5c3d\u91cf\u91cd\u590d\u4f7f\u7528\u5bf9\u8c61\u7531\u4e8e\u521b\u5efa\u5bf9\u8c61\u7684\u6210\u672c\u5f88\u9ad8\uff0c\u5982\u679c\u91cd\u65b0\u4f7f\u7528\uff0c\u53ef\u80fd\u4f1a\u51fa\u9519\u3002\u4e0d\u7528\u62c5\u5fc3\uff0c\u6700\u597d\u8fd8\u662f\u521b\u5efa\u65b0\u5bf9\u8c61\u3002\u5f53\u7136\uff0c\u5728\u9700\u8981\u8003\u8651\u6027\u80fd\u7684\u60c5\u51b5\u4e0b\u53ef\u4ee5\u8fdb\u884c\u91cd\u7528\u3002<\/p>\n<h3>\u5728\u8c03\u7528\u9759\u6001\u65b9\u6cd5\u65f6\uff0c\u5fc5\u987b\u4f7f\u7528\u7c7b\u540d\u800c\u4e0d\u662f\u53d8\u91cf\u540d\u3002\u5373\u4f7f\u5728\u81ea\u5df1\u7684\u7c7b\u4e2d\uff0c\u4e5f\u8981\u5199\u4e0a\u7c7b\u540d\u3002\u8c03\u7528\u9759\u6001\u65b9\u6cd5\u7684\u884c\u4e3a\u66f4\u52a0\u660e\u786e\uff0c\u4f7f\u5f97\u6e90\u4ee3\u7801\u66f4\u6613\u4e8e\u9605\u8bfb\u3002<\/p>\n<h3>\u5c3d\u91cf\u4e0d\u8981\u4f7f\u7528StringBuilder\uff08StringBuffer\uff09\u3002\u5c3d\u7ba1\u8fd9\u53ef\u80fd\u4f1a\u53d7\u5230\u6279\u8bc4\uff0c\u4f46\u6e90\u4ee3\u7801\u7684\u6613\u8bfb\u6027\u66f4\u91cd\u8981\u3002<br \/>\n\u786e\u5b9e\uff0c\u6027\u80fd\u4f1a\u6709\u6240\u4e0d\u540c\u3002\u7136\u800c\uff0c\u5728\u8bb8\u591a\u60c5\u51b5\u4e0b\uff0c\u7edd\u5bf9\u65f6\u95f4\u672c\u6765\u5c31\u5f88\u5c11\u3002<br \/>\n\u9664\u975e\u8fdb\u884c\u975e\u5e38\u591a\u7684\u5faa\u73af\u7b49\u64cd\u4f5c\u65f6\uff0c\u4e0d\u5efa\u8bae\u4f7f\u7528StringBuilder\u3002<br \/>\n\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u5728\u6211\u7684\u6d4b\u8bd5\u4e2d\uff0c\u5f53\u4e0d\u4f7f\u7528StringBuilder\uff08\u6216StringBuffer\uff09\u8fdb\u884c\u5b57\u7b26\u4e32\u62fc\u63a5\u65f6\uff0c\u6240\u9700\u65f6\u95f4\u5927\u7ea6\u662f\u5b83\u768410\u500d\u3002<\/p>\n<h3>\u4e3a\u4e86\u65b9\u4fbf\u8fdb\u884c\u5355\u5143\u6d4b\u8bd5\uff0c\u5c06\u5185\u5b58\u4e2d\u7684\u903b\u8f91\u8f6c\u79fb\u5230\u65b9\u6cd5\u4e2d\u3002\u8fd9\u4e5f\u662f\u60c5\u5883\u5224\u65ad\u7684\u4e00\u90e8\u5206\uff0c\u4e00\u5b9a\u7a0b\u5ea6\u653e\u5bbd\u5916\u51fa\u662f\u597d\u7684\u3002\u7136\u800c\uff0c\u5982\u679c\u505a\u5f97\u8fc7\u591a\uff0c\u65b9\u6cd5\u7684\u6570\u91cf\u5c31\u4f1a\u53d8\u591a\uff0c\u4f1a\u5f15\u8d77\u6df7\u4e71\u3002<\/p>\n<h3>\u5411List\u3001Set\u3001Map\u7b49\u5bf9\u8c61\u6dfb\u52a0\u5b50\u5bf9\u8c61\u65f6\uff0c\u5e94\u5728\u521b\u5efa\u5b50\u5bf9\u8c61\u4e4b\u540e\u7acb\u5373\u8fdb\u884c\u6dfb\u52a0\u3002\u4e3a\u4e86\u9632\u6b62\u5728\u65b0\u589e\u540e\u5fd8\u8bb0\u6dfb\u52a0\u5904\u7406\u7a0b\u5e8f\u8fd9\u79cd\u60c5\u51b5\uff0c\u9700\u8981\u5f62\u6210\u4e00\u4e2a\u4e60\u60ef\uff0c\u4ee5\u514d\u5fd8\u8bb0\u3002\u8fd9\u5c06\u6709\u52a9\u4e8e\u9632\u6b62\u51fa\u73b0\u96be\u4ee5\u7406\u89e3\u7684\u9519\u8bef\uff08\u6709\u65f6\uff09\u3002<\/p>\n<p>\u5f53\u5b58\u5728\u4e0a\u8ff0\u4f8b\u5916\u65f6\uff0c\u662f\u5728\u8bbe\u7f6e\u65b0\u521b\u5efa\u5bf9\u8c61\u7684\u503c\uff0c\u5e76\u4e14\u5728\u7279\u5b9a\u6761\u4ef6\u4e0b\u53ef\u80fd\u4e0d\u8fdb\u884c\u6dfb\u52a0\u3002<\/p>\n<h3>\u5728\u5f02\u5e38\u5904\u7406\u4e2d\uff0c\u5fc5\u987b\u59cb\u7ec8\u4f7f\u7528finaly\uff0c\u901a\u5e38\u4e0d\u4f7f\u7528catch\u3002\u65e0\u8bba\u662fcatch\u8fd8\u662f\u4e0dcatch\u5f02\u5e38\uff0c\u53ef\u80fd\u90fd\u4f1a\u51fa\u73b0\uff0c\u4f46\u662f\u4e0dcatch\u7684\u60c5\u51b5\u53ef\u80fd\u66f4\u591a\u3002<br \/>\n\u8bf7\u8bb0\u5f97\u5728\u6700\u540e\u52a0\u4e0afinally\u8bed\u53e5\u5757\u3002<br \/>\n\u5373\u4f7f\u4e0d\u9700\u8981\u8fdb\u884cfinally\u5904\u7406\uff0c\u4e5f\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u7a7a\u7684finally\u5757\uff0c\u5e76\u5199\u4e0a&#8221;\u65e0\u5904\u7406&#8221;\u3002<\/p>\n<h2>\u5171\u540c\u7684\u8bfe\u7a0b<\/p>\n<h3>\u521b\u5efa\u4e00\u4e2a\u5171\u540c\u7684\u7c7b\u6765\u5904\u7406\u65e5\u671f\u548c\u65f6\u95f4\u21d2\u7edf\u4e00\u65e5\u671f\u683c\u5f0f\u3001\u7edf\u4e00\u65e5\u671f\u548c\u65f6\u95f4\u5904\u7406<br \/>\n\u5728\u7cfb\u7edf\u7684\u5404\u4e2a\u65b9\u9762\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u6709\u5f88\u591a\u76f8\u540c\u7684\u5904\u7406\u65b9\u5f0f\u6765\u5904\u7406\u65e5\u671f\u548c\u65f6\u95f4\u3002\u76f8\u540c\u7684\u683c\u5f0f\u88ab\u63cf\u8ff0\u5728\u5404\u4e2a\u5730\u65b9\u3002\u7279\u522b\u662f\u5728\u8fdb\u884c\u65e5\u671f\u5904\u7406\u65f6\uff0c\u7531\u4e8e\u65f6\u95f4\u8bef\u5dee\u53ef\u80fd\u4f1a\u5f15\u5165\u9519\u8bef\uff0c\u56e0\u6b64\u9700\u8981\u91c7\u53d6\u63aa\u65bd\u6765\u9632\u6b62\u8fd9\u79cd\u60c5\u51b5\u53d1\u751f\u3002<\/p>\n<h3>\u521b\u5efa\u5171\u4eab\u7c7b\u6765\u5904\u7406\u53cd\u5c04\u3001\u901a\u4fe1\u3001IO\u7b49\uff0c\u4ee5\u907f\u514d\u4e0e\u5176\u4ed6\u903b\u8f91\u6df7\u5408\u3002\u5c31\u50cf\u5c06\u6570\u636e\u5e93\u8bbf\u95ee\u4f5c\u4e3aDAO\u5916\u90e8\u5316\u4e00\u6837\uff0c\u5c06\u8fd9\u4e9b\u7c7b\u4f3c\u7684\u7279\u6b8a\u5904\u7406\u64cd\u4f5c\u7edf\u4e00\u653e\u5728\u5171\u7528\u7684\u7c7b\u4e2d\u3002<\/p>\n<h3>\u5c06\u65b9\u6cd5\u7684\u53c2\u6570\u6570\u5b57\u6570\u7ec4\u8f6c\u6362\u4e3a\u5305\u88c5\u5668\u800c\u4e0d\u662f\u539f\u59cb\u7c7b\u578b\u3002\u5728\u539f\u59cb\u7c7b\u578b\u4e2d\uff0c\u9700\u8981\u4e3a\u6bcf\u79cd\u7c7b\u578b\u521b\u5efa\u65b9\u6cd5\u3002<br \/>\n\u5728\u5305\u88c5\u7c7b\u4e2d\uff0c\u53ef\u4ee5\u7edf\u4e00\u4f7f\u7528Number\u3002\u4e0d\u8fc7\uff0cBigDecimal\u4e5f\u5c5e\u4e8eNumber\uff0c\u8fd9\u5c31\u5f88\u68d8\u624b\u4e86\u3002<\/p>\n<h3>\u4e3a\u4e86\u4f7f\u7c7b\u540d\u548c\u65b9\u6cd5\u540d\u66f4\u52a0\u6613\u61c2\uff0c\u521b\u5efa\u4e00\u4e2a\u6d3e\u751f\u7c7b\u3002\u5728\u5171\u901a\u7c7b\u4e2d\uff0c\u6709\u65f6\u7c7b\u540d\u548c\u65b9\u6cd5\u540d\u4e0e\u4e1a\u52a1\u5185\u5bb9\u4e0d\u76f8\u7b26\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5b9a\u4e49\u6d3e\u751f\u7c7b\u5e76\u4f7f\u7528\u6613\u4e8e\u7406\u89e3\u7684\u540d\u79f0\u3002\u4f46\u662f\u5982\u679c\u8fc7\u5206\u4f7f\u7528\uff0c\u7c7b\u7684\u6570\u91cf\u4f1a\u53d8\u5f97\u5f88\u591a\u3002<\/p>\n<h3>\u6574\u7406\u9879\u76ee\u4e2d\u7684\u516c\u5171\u7c7b\u4f1a\u589e\u52a0\u6210\u672c\uff0c\u4f46\u5e94\u8be5\u63a8\u52a8\u3002\u5728\u9879\u76ee\u4e2d\u6574\u5907\u5171\u7528\u7c7b\u662f\u4e00\u4e2a\u589e\u52a0\u6210\u672c\u7684\u56e0\u7d20\uff0c\u4f46\u662f\u4e5f\u662f\u5fc5\u987b\u7684\u3002\u6574\u5907\u7c7b\u7684\u6210\u672c\u548c\u56e2\u961f\u6210\u5458\u7406\u89e3\u89c4\u8303\u6240\u9700\u7684\u6210\u672c\u8d85\u8fc7\u4e86\u5176\u4ed6\u56e0\u7d20\u3002\u5728\u9879\u76ee\u4e2d\u5171\u7528\u7c7b\u7684\u6574\u5907\u662f\u4e3a\u4e86\u63d0\u9ad8\u8d28\u91cf\uff0c\u5982\u679c\u6ca1\u6709\u8fd9\u4e2a\u8ba4\u8bc6\uff0c\u5c31\u4f1a\u53d8\u5f97\u6cae\u4e27\u3002<\/p>\n<h3>\u5728\u4f01\u4e1a\u5185\u90e8\uff0c\u5e94\u8be5\u4ee5\u957f\u671f\u7684\u5c55\u671b\u6765\u8fdb\u884c\u89c4\u5212\u548c\u6574\u5907\u3002\u4ece\u957f\u8fdc\u7684\u89d2\u5ea6\u770b\uff0c\u4e5f\u80fd\u591f\u5b9e\u73b0\u6210\u672c\u524a\u51cf\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148 \u8bf7\u6ce8\u610f\u4ee5\u4e0b\u4e8b\u9879\uff0c\u5e76\u8fd0\u7528\u5b83\u4eec\u6765\u63d0\u9ad8Java\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u4fe1\u8d56\u6027\u3002 \u5305\u62ec\u7684\u306b\u8ff0\u3079\u305f\u3082\u306e\u3067\u306f\u306a\u3044. &#038;nbs [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[227],"class_list":["post-31272","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java\u7f16\u7801\u89c4\u8303 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8eJava\u7f16\u7801\u89c4\u8303\u7684\u6280\u672f\u6587\u7ae0\" \/>\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.silicloud.com\/zh\/blog\/java\u7f16\u7801\u89c4\u8303\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java\u7f16\u7801\u89c4\u8303\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8eJava\u7f16\u7801\u89c4\u8303\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/java\u7f16\u7801\u89c4\u8303\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-10T19:42:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-12T15:10:39+00:00\" \/>\n<meta name=\"author\" content=\"\u79d1, \u9896\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u9896\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/\",\"name\":\"Java\u7f16\u7801\u89c4\u8303 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-04-10T19:42:23+00:00\",\"dateModified\":\"2025-08-12T15:10:39+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e\"},\"description\":\"\u5173\u4e8eJava\u7f16\u7801\u89c4\u8303\u7684\u6280\u672f\u6587\u7ae0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\u7f16\u7801\u89c4\u8303\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e\",\"name\":\"\u79d1, \u9896\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u9896\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keying\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java\u7f16\u7801\u89c4\u8303 - Blog - Silicon Cloud","description":"\u5173\u4e8eJava\u7f16\u7801\u89c4\u8303\u7684\u6280\u672f\u6587\u7ae0","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.silicloud.com\/zh\/blog\/java\u7f16\u7801\u89c4\u8303\/","og_locale":"zh_CN","og_type":"article","og_title":"Java\u7f16\u7801\u89c4\u8303","og_description":"\u5173\u4e8eJava\u7f16\u7801\u89c4\u8303\u7684\u6280\u672f\u6587\u7ae0","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/java\u7f16\u7801\u89c4\u8303\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-04-10T19:42:23+00:00","article_modified_time":"2025-08-12T15:10:39+00:00","author":"\u79d1, \u9896","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u9896","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/","name":"Java\u7f16\u7801\u89c4\u8303 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-04-10T19:42:23+00:00","dateModified":"2025-08-12T15:10:39+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e"},"description":"\u5173\u4e8eJava\u7f16\u7801\u89c4\u8303\u7684\u6280\u672f\u6587\u7ae0","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Java\u7f16\u7801\u89c4\u8303"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e","name":"\u79d1, \u9896","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g","caption":"\u79d1, \u9896"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keying\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/java%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/31272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=31272"}],"version-history":[{"count":3,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/31272\/revisions"}],"predecessor-version":[{"id":111910,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/31272\/revisions\/111910"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=31272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=31272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=31272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}