{"id":318,"date":"2023-09-16T10:32:10","date_gmt":"2023-09-16T02:32:10","guid":{"rendered":""},"modified":"2023-09-18T11:49:45","modified_gmt":"2023-09-18T03:49:45","slug":"java%e5%a6%82%e4%bd%95%e7%bb%99%e6%95%b0%e7%bb%84%e5%88%9d%e5%a7%8b%e5%8c%96%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/mushiming.com\/318.html","title":{"rendered":"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f"},"content":{"rendered":"

\u5173\u4e8ejava\u6570\u7ec4\u7684\u6587\u7ae0\u65e9\u5df2\u662f\u975e\u5e38\u591a\u4e86\uff0c\u672c\u6587\u662f\u5bf9\u6211\u4e2a\u4eba\u8fc7\u5f80\u5b66\u4e60java\uff0c\u7406\u89e3\u53ca\u5e94\u7528java\u6570\u7ec4\u7684\u4e00\u4e2a\u603b\u7ed3\u3002\u6b64\u6587\u5185\u5bb9\u6d89\u53cajava\u6570\u7ec4\u7684\u57fa\u672c\u6982\u5ff5\uff0c\u4ee5\u53cajava\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316?\u521d\u59cb\u5316\u7684\u51e0\u79cd\u65b9\u5f0f?\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<\/span><\/p>\n

java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316?<\/strong><\/span><\/p>\n

Java\u8bed\u8a00\u4e2d\u6570\u7ec4\u5fc5\u987b\u5148\u521d\u59cb\u5316\uff0c\u7136\u540e\u624d\u53ef\u4ee5\u4f7f\u7528\u3002\u6240\u8c13\u521d\u59cb\u5316\u5c31\u662f\u4e3a\u6570\u7ec4\u7684\u6570\u7ec4\u5143\u7d20\u5206\u914d\u5185\u5b58\u7a7a\u95f4\uff0c\u5e76\u4e3a\u6bcf\u4e2a\u6570\u7ec4\u5143\u7d20\u9644\u521d\u59cb\u503c\u3002<\/span><\/p>\n

\u6ce8\u610f\uff1a\u6570\u7ec4\u5b8c\u6210\u521d\u59cb\u5316\u540e\uff0c\u5185\u5b58\u7a7a\u95f4\u4e2d\u9488\u5bf9\u8be5\u6570\u7ec4\u7684\u5404\u4e2a\u5143\u7d20\u5c31\u6709\u4e2a\u4e00\u4e2a\u9ed8\u8ba4\u503c\uff1a<\/span><\/p>\n

\u57fa\u672c\u6570\u636e\u7c7b\u578b\u7684\u6574\u6570\u7c7b\u578b(byte\u3001short\u3001int\u3001long)\u9ed8\u8ba4\u503c\u662f0;<\/span><\/p>\n

\u57fa\u672c\u6570\u636e\u7c7b\u578b\u7684\u6d6e\u70b9\u7c7b\u578b(float\u3001double)\u9ed8\u8ba4\u503c\u662f0.0;<\/span><\/p>\n

\u57fa\u672c\u6570\u636e\u7c7b\u578b\u7684\u5b57\u7b26\u7c7b\u578b(char)\u9ed8\u8ba4\u503c\u662f'\\u0000';<\/span><\/p>\n

\u57fa\u672c\u6570\u636e\u7c7b\u578b\u7684\u5e03\u5c14\u7c7b\u578b(boolean)\u9ed8\u8ba4\u503c\u662ffalse;<\/span><\/p>\n

\u7c7b\u578b\u7684\u5f15\u7528\u7c7b\u578b(\u7c7b\u3001\u6570\u7ec4\u3001\u63a5\u53e3\u3001String)\u9ed8\u8ba4\u503c\u662fnull.<\/span><\/p>\n

\u521d\u59cb\u5316\u65b9\u5f0f\uff1a<\/strong><\/span><\/p>\n

\u4e00.\u9759\u6001\u521d\u59cb\u5316\uff1a\u521d\u59cb\u5316\u65f6\u7531\u7a0b\u5e8f\u5458\u663e\u5f0f\u6307\u5b9a\u6bcf\u4e2a\u6570\u7ec4\u5143\u7d20\u7684\u521d\u59cb\u503c\uff0c\u6709\u7cfb\u7edf\u51b3\u5b9a\u6570\u7ec4\u7684\u957f\u5ea6;<\/span><\/p>\n

1.arrayName = new type[]{element1,element2,element3...}<\/span><\/p>\n

\"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/p>\n

2.\u7b80\u5316\u7684\u9759\u6001\u521d\u59cb\u5316\u65b9\u5f0f type[] arrayName = {element1,element2,element3...};<\/span><\/p>\n

\"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/p>\n

\u4e8c.\u52a8\u6001\u521d\u59cb\u5316\uff1a\u521d\u59cb\u5316\u65f6\u7531\u7a0b\u5e8f\u5458\u6307\u5b9a\u6570\u7ec4\u7684\u957f\u5ea6\uff0c\u7531\u7cfb\u7edf\u521d\u59cb\u5316\u6bcf\u4e2a\u6570\u7ec4\u5143\u7d20\u7684\u9ed8\u8ba4\u503c\u3002<\/span><\/p>\n

arrayName = new type[length];<\/span><\/p>\n

\u793a\u4f8b\uff1a<\/strong><\/span><\/p>\n

\"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/p>\n

\u6ce8\u610f\uff1a\u4e0d\u8981\u540c\u65f6\u4f7f\u7528\u9759\u6001\u521d\u59cb\u5316\u548c\u52a8\u6001\u521d\u59cb\u5316\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u4e0d\u8981\u5728\u8fdb\u884c\u6570\u7ec4\u521d\u59cb\u5316\u65f6\uff0c\u65e2\u6307\u5b9a\u6570\u7ec4\u7684\u957f\u5ea6\uff0c\u4e5f\u4e3a\u6bcf\u4e2a\u6570\u7ec4\u5143\u7d20\u5206\u914d\u521d\u59cb\u503c\u3002<\/span><\/p>\n

\u4e00\u65e6\u6570\u7ec4\u5b8c\u6210\u521d\u59cb\u5316\uff0c\u6570\u7ec4\u5728\u5185\u5b58\u4e2d\u6240\u5360\u7684\u7a7a\u95f4\u5c06\u88ab\u56fa\u5b9a\u4e0b\u6765\uff0c\u6240\u4ee5\u6570\u7ec4\u7684\u957f\u5ea6\u5c06\u4e0d\u53ef\u6539\u53d8\u3002<\/span><\/p>\n

\n

\u8fd9\u91cc\u6211\u514d\u8d39\u5206\u4eab\u4e00\u4efdGitHub \u4e0a\u6807\u661f 120k\u7684\u300aJava\u6838\u5fc3\u8fdb\u9636\u77e5\u8bc6\u5168\u9762\u89e3\u6790\u300b\u7ed9\u5927\u5bb6\u770b\u770b\uff0c\u4e0d\u8bba\u662f\u7528\u4e8e\u5de9\u56fa\u57fa\u7840\uff0c\u8fd8\u662f\u7528\u4e8e\u6280\u672f\u63d0\u5347\u90fd\u53ef\u4ee5\u6536\u85cf\u4e00\u4efd\uff0c\u770b\u5b8c\u5b66\u900f\uff0c\u9762\u8bd5\u5927\u5382so easy\u3002<\/span><\/p>\n<\/p>\n

\u4e0b\u9762\u5c55\u793a\u90e8\u5206\u622a\u56fe\uff0c\u6587\u672b\u9644\u514d\u8d39\u4e0b\u8f7d\u65b9\u5f0f\u3002<\/span><\/strong><\/span><\/h2>\n<\/blockquote>\n

(\u4e00). \u57fa\u7840<\/strong><\/span><\/h2>\n

1\u3001Java \u57fa\u672c\u529f<\/span><\/p>\n

    \n
  • Java \u5165\u95e8(\u57fa\u7840\u6982\u5ff5\u4e0e\u5e38\u8bc6)<\/span><\/li>\n
  • Java \u8bed\u6cd5<\/span><\/li>\n
  • \u57fa\u672c\u6570\u636e\u7c7b\u578b<\/span><\/li>\n
  • \u65b9\u6cd5(\u51fd\u6570)<\/span><\/li>\n<\/ul>\n

    \"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/span><\/p>\n

    2\u3001Java \u9762\u5411\u5bf9\u8c61<\/span><\/p>\n

      \n
    • \u7c7b\u548c\u5bf9\u8c61<\/span><\/li>\n
    • \u9762\u5411\u5bf9\u8c61\u4e09\u5927\u7279\u5f81<\/span><\/li>\n
    • \u4fee\u9970\u7b26<\/span><\/li>\n
    • \u63a5\u53e3\u548c\u62bd\u8c61\u7c7b<\/span><\/li>\n
    • \u5176\u5b83\u91cd\u8981\u77e5\u8bc6\u70b9<\/span><\/li>\n<\/ul>\n

      \"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/span><\/p>\n

      3\u3001Java \u6838\u5fc3\u6280\u672f<\/span><\/p>\n

        \n
      • \u96c6\u5408<\/span><\/li>\n
      • \u5f02\u5e38<\/span><\/li>\n
      • \u591a\u7ebf\u7a0b<\/span><\/li>\n
      • \u6587\u4ef6\u4e0e I\\O \u6d41<\/span><\/li>\n<\/ul>\n

        \"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/span><\/p>\n

        (\u4e8c). \u5e76\u53d1<\/span><\/h2>\n

        1\u3001\u5e76\u53d1\u5bb9\u5668<\/span><\/p>\n

          \n
        • JDK \u63d0\u4f9b\u7684\u5e76\u53d1\u5bb9\u5668\u603b\u7ed3<\/span><\/li>\n
        • ConcurrentHashMap<\/span><\/li>\n
        • CopyOnWriteArrayList<\/span><\/li>\n
        • ConcurrentLinkedQueue<\/span><\/li>\n
        • BlockingQueue<\/span><\/li>\n
        • ConcurrentSkipListMap<\/span><\/li>\n<\/ul>\n

          \"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/span><\/p>\n

          2\u3001\u7ebf\u7a0b\u6c60<\/span><\/p>\n

            \n
          • \u4f7f\u7528\u7ebf\u7a0b\u6c60\u7684\u597d\u5904<\/span><\/li>\n
          • Executor \u6846\u67b6<\/span><\/li>\n
          • (\u91cd\u8981)ThreadPoolExecutor \u7c7b\u7b80\u5355\u4ecb\u7ecd<\/span><\/li>\n
          • (\u91cd\u8981)ThreadPoolExecutor \u4f7f\u7528\u793a\u4f8b<\/span><\/li>\n
          • \u51e0\u79cd\u5e38\u89c1\u7684\u7ebf\u7a0b\u6c60\u8be6\u89e3<\/span><\/li>\n
          • ScheduledThreadPoolExecutor \u8be6\u89e3<\/span><\/li>\n
          • \u7ebf\u7a0b\u6c60\u5927\u5c0f\u786e\u5b9a<\/span><\/li>\n<\/ul>\n

            \"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/span><\/p>\n

            3\u3001\u4e50\u89c2\u9501\u4e0e\u60b2\u89c2\u9501<\/span><\/p>\n

              \n
            • \u4f55\u8c13\u60b2\u89c2\u9501\u4e0e\u4e50\u89c2\u9501<\/span><\/li>\n
            • \u4e50\u89c2\u9501\u5e38\u89c1\u7684\u4e24\u79cd\u5b9e\u73b0\u65b9\u5f0f<\/span><\/li>\n
            • \u4e50\u89c2\u9501\u7684\u7f3a\u70b9<\/span><\/li>\n
            • CAS\u4e0esynchronized\u7684\u4f7f\u7528\u60c5\u666f<\/span><\/li>\n<\/ul>\n

              \"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/span><\/p>\n

              (\u4e09). JVM<\/span><\/h2>\n

              1\u3001Java\u5185\u5b58\u533a\u57df<\/span><\/p>\n

                \n
              • \u6982\u8ff0<\/span><\/li>\n
              • \u8fd0\u884c\u65f6\u6570\u636e\u533a\u57df<\/span><\/li>\n
              • HotSpot \u865a\u62df\u673a\u5bf9\u8c61\u63a2\u79d8<\/span><\/li>\n
              • \u91cd\u70b9\u8865\u5145\u5185\u5bb9<\/span><\/li>\n<\/ul>\n

                \"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/span><\/p>\n

                2\u3001JVM\u5783\u573e\u56de\u6536<\/span><\/p>\n

                  \n
                • \u63ed\u5f00 JVM \u5185\u5b58\u5206\u914d\u4e0e\u56de\u6536\u7684\u795e\u79d8\u9762\u7eb1<\/span><\/li>\n
                • \u5bf9\u8c61\u5df2\u7ecf\u6b7b\u4ea1?<\/span><\/li>\n
                • \u5783\u573e\u6536\u96c6\u7b97\u6cd5<\/span><\/li>\n
                • \u5783\u573e\u6536\u96c6\u5668<\/span><\/li>\n<\/ul>\n

                  \"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/span><\/p>\n

                  3\u3001JDK \u76d1\u63a7\u548c\u6545\u969c\u5904\u7406\u5de5\u5177<\/span><\/p>\n

                    \n
                  • JDK \u547d\u4ee4\u884c\u5de5\u5177<\/span><\/li>\n
                  • JDK \u53ef\u89c6\u5316\u5206\u6790\u5de5\u5177<\/span><\/li>\n<\/ul>\n

                    \"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/span><\/p>\n

                    \uff08\u56db\uff09\u7f51\u7edc\u3001linux\u3001\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u6cd5\u3001\u6570\u636e\u5e93\u3001\u7cfb\u7edf\u8bbe\u8ba1\u3001\u5fc5\u4f1a\u5de5\u5177\u3001\u9762\u8bd5\u6307\u5357<\/strong><\/span><\/h2>\n

                    \"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f<\/span><\/p>\n

                    \u56e0\u4e3a\u7bc7\u5e45\u6709\u9650\uff0c\u5176\u4ed6\u5185\u5bb9\u5c31\u4e0d\u4e00\u4e00\u5c55\u793a\u4e86\uff0c\u8fd9\u672c\u8fdb\u9636\u7b14\u8bb0\u603b\u5171\u6709512\u9875\u3002\u5bf9\u4e8e\u60f3\u8981\u8fdb\u9636\u7684\u5c0f\u4f19\u4f34\u6765\u8bf4\u5e94\u8be5\u4f1a\u5f88\u6709\u5e2e\u52a9\uff0c\u5e0c\u671b\u4e5f\u80fd\u5e2e\u52a9\u5230\u4f60\u3002<\/span><\/p>\n

                    \u9700\u8981\u7684\u5c0f\u4f19\u4f34\u53ef\u4ee5\u70b9\u51fb\u4e0b\u9762\u7684\u540d\u7247\u514d\u8d39\u9886\u53d6\u3002<\/span><\/strong><\/span><\/h2>\n","protected":false},"excerpt":{"rendered":"java\u5982\u4f55\u7ed9\u6570\u7ec4\u521d\u59cb\u5316\uff1f\u5173\u4e8ejava\u6570\u7ec4\u7684\u6587\u7ae0\u65e9\u5df2\u662f\u975e\u5e38\u591a\u4e86\uff0c\u672c\u6587\u662f\u5bf9\u6211\u4e2a\u4eba\u8fc7\u5f80\u5b66\u4e60java\uff0c\u7406\u89e3\u53ca\u5e94\u7528java\u6570\u7ec4\u7684\u4e00\u4e2a\u603b\u7ed3\u3002\u6b64...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/318"}],"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=318"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/318\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}