{"id":656,"date":"2022-10-04T00:12:18","date_gmt":"2022-10-03T16:12:18","guid":{"rendered":"https:\/\/qaqaq.top\/?p=656"},"modified":"2022-11-27T12:39:57","modified_gmt":"2022-11-27T04:39:57","slug":"%e9%9d%a2%e5%90%91%e5%af%b9%e8%b1%a1%e4%b8%8a-package%e5%85%b3%e9%94%ae%e5%ad%97%e7%9a%84%e4%bd%bf%e7%94%a8%e3%80%81import%e5%85%b3%e9%94%ae%e5%ad%97%e7%9a%84%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/qaqaq.top\/?p=656","title":{"rendered":"\u9762\u5411\u5bf9\u8c61(\u4e0a)-package\u5173\u952e\u5b57\u7684\u4f7f\u7528\u3001import\u5173\u952e\u5b57\u7684\u4f7f\u7528"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P238;\r\n\r\nimport java.lang.reflect.Field;\r\nimport java.util.*;\r\n\r\nimport top.qaqaq.java.P237.Account;\r\nimport top.qaqaq.java.P237.Bank;\r\n\r\nimport static java.lang.System.*;\r\nimport static java.lang.Math.*;\r\n\r\n\/*\r\n * \u4e00\u3001package\u5173\u952e\u5b57\u7684\u4f7f\u7528\r\n * 1. \u4e3a\u4e86\u66f4\u597d\u7684\u5b9e\u73b0\u9879\u76ee\u4e2d\u7c7b\u7684\u7ba1\u7406\uff0c\u63d0\u4f9b\u5305\u7684\u6982\u5ff5\r\n * 2. \u4f7f\u7528package\u58f0\u660e\u7c7b\u6216\u63a5\u53e3\u6240\u5c5e\u7684\u5305\uff0c\u58f0\u660e\u5728\u6e90\u6587\u4ef6\u7684\u9996\u884c\r\n * 3. \u5305\uff0c\u5c5e\u4e8e\u6807\u8bc6\u7b26\uff0c\u9075\u5faa\u6807\u8bc6\u7b26\u7684\u547d\u540d\u89c4\u5219\u3001\u89c4\u8303(xxxyyyzzz)\u3001\u201c\u89c1\u540d\u77e5\u610f\u201d\r\n * 4. \u6bcf\".\"\u4e00\u6b21\uff0c\u5c31\u4ee3\u8868\u4e00\u5c42\u6587\u4ef6\u76ee\u5f55\u3002\r\n * \r\n * \u8865\u5145\uff1a\u540c\u4e00\u4e2a\u5305\u4e0b\uff0c\u4e0d\u80fd\u547d\u540d\u540c\u540d\u7684\u63a5\u53e3\u3001\u7c7b\u3002\r\n * \t\t\u4e0d\u540c\u7684\u5305\u4e0b\uff0c\u53ef\u4ee5\u547d\u540d\u540c\u540d\u7684\u63a5\u53e3\u3001\u7c7b\u3002\r\n * \r\n * \u4e8c\u3001import\u5173\u952e\u5b57\u7684\u4f7f\u7528\r\n * import:\u5bfc\u5165\r\n * 1. \u5728\u6e90\u6587\u4ef6\u4e2d\u663e\u5f0f\u7684\u4f7f\u7528import\u7ed3\u6784\u5bfc\u5165\u6307\u5b9a\u5305\u4e0b\u7684\u7c7b\u3001\u63a5\u53e3\r\n * 2. \u58f0\u660e\u5728\u5305\u7684\u58f0\u660e\u548c\u7c7b\u7684\u58f0\u660e\u4e4b\u95f4\r\n * 3. \u5982\u679c\u9700\u8981\u5bfc\u5165\u591a\u4e2a\u7ed3\u6784\uff0c\u5219\u5e76\u5217\u5199\u51fa\u5373\u53ef\r\n * 4. \u53ef\u4ee5\u4f7f\u7528\"xxx.*\"\u7684\u65b9\u5f0f\uff0c\u8868\u793a\u53ef\u4ee5\u5bfc\u5165xxx\u5305\u4e0b\u7684\u6240\u6709\u7ed3\u6784\r\n * 5. \u5982\u679c\u4f7f\u7528\u7684\u7c7b\u6216\u63a5\u53e3\u662fjava.lang\u5305\u4e0b\u5b9a\u4e49\u7684\uff0c\u5219\u53ef\u4ee5\u7701\u7565import\u7ed3\u6784\r\n * 6. \u5982\u679c\u4f7f\u7528\u7684\u7c7b\u6216\u63a5\u53e3\u662f\u672c\u5305\u4e0b\u5b9a\u4e49\u7684\uff0c\u5219\u4e5f\u53ef\u4ee5\u7701\u7565import\u7ed3\u6784\r\n * 7. \u5982\u679c\u5728\u6e90\u6587\u4ef6\u4e2d\uff0c\u4f7f\u7528\u4e86\u4e0d\u540c\u5305\u4e0b\u7684\u540c\u540d\u7684\u7c7b\uff0c\u5219\u5fc5\u987b\u81f3\u5c11\u6709\u4e00\u4e2a\u7c7b\u9700\u8981\u4ee5\u5168\u7c7b\u540d\u7684\u65b9\u5f0f\u663e\u5f0f\u3002\r\n * 8. \u4f7f\u7528\"xxx.*\"\u65b9\u5f0f\u8868\u660e\u53ef\u4ee5\u8c03\u7528xxx\u5305\u4e0b\u7684\u6240\u6709\u7ed3\u6784\u3002\u4f46\u662f\u5982\u679c\u4f7f\u7528\u7684\u662fxxx\u5b50\u5305\u4e0b\u7684\u7ed3\u6784\uff0c\u5219\u4ecd\u9700\u8981\u663e\u793a\u5bfc\u5165\r\n * \r\n * 9. import static\uff1a\u5bfc\u5165\u6307\u5b9a\u7c7b\u6216\u63a5\u53e3\u4e2d\u7684\u9759\u6001\u7ed3\u6784\uff1a\u5c5e\u6027\u6216\u65b9\u6cd5\u3002\r\n * \r\n *\/\r\npublic class PackageImportTest {\r\n\t\r\n\tpublic static void main(String&#91;] args) {\r\n\t\t\r\n\t\tString info = Arrays.toString(new int&#91;] {1,2,3});\r\n\t\t\r\n\t\tBank bank = new Bank();\r\n\t\t\r\n\t\tArrayList list = new ArrayList();\r\n\t\t\r\n\t\tHashMap map = new HashMap();\r\n\t\t\r\n\t\tScanner s = null;\r\n\t\t\r\n\t\tSystem.out.println(\"hello\");\r\n\t\t\r\n\t\tPerson p = new Person();\r\n\t\t\r\n\t\tAccount acct = new Account(1000);\r\n\t\t\/\/\u5168\u7c7b\u540d\u7684\u65b9\u5f0f\u663e\u793a\r\n\t\ttop.qaqaq.java.P236.Account acct1 = new top.qaqaq.java.P236.Account(1000,2000,0.0123);\r\n\t\t\r\n\t\tDate date = new Date();\r\n\t\tjava.sql.Date date1 = new java.sql.Date(5243523532535L);\r\n\t\t\r\n\/\/\t\tDog dog = new Dog();\r\n\t\t\r\n\t\tField field = null;\r\n\t\t\r\n\t\tout.println(\"hello\");\r\n\t\t\r\n\t\tlong num = round(123.434);\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P238;\r\n\r\npublic class Person {\r\n\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[46],"class_list":["post-656","post","type-post","status-publish","format-standard","hentry","category-java-code","tag-java"],"_links":{"self":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/656"}],"collection":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=656"}],"version-history":[{"count":1,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/656\/revisions"}],"predecessor-version":[{"id":657,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/656\/revisions\/657"}],"wp:attachment":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}