{"id":36108,"date":"2024-11-26T17:34:24","date_gmt":"2024-11-26T09:34:24","guid":{"rendered":"https:\/\/fwq.ai\/blog\/36108\/"},"modified":"2024-11-26T17:34:24","modified_gmt":"2024-11-26T09:34:24","slug":"java%e4%b8%ad%e4%b8%bb%e5%8a%a8%e6%8a%9b%e5%87%ba%e8%bf%90%e8%a1%8c%e6%97%b6%e5%bc%82%e5%b8%b8%ef%bc%9a%e8%b0%81%e6%9d%a5%e5%a4%84%e7%90%86%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/36108\/","title":{"rendered":"Java\u4e2d\u4e3b\u52a8\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\uff1a\u8c01\u6765\u5904\u7406\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173096190433653.jpg\" class=\"aligncenter\" title=\"Java\u4e2d\u4e3b\u52a8\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\uff1a\u8c01\u6765\u5904\u7406\uff1f\u63d2\u56fe\" alt=\"Java\u4e2d\u4e3b\u52a8\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\uff1a\u8c01\u6765\u5904\u7406\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4e3b\u52a8\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\uff1a\u65e0\u58f0\u660e\uff0c\u8c01\u5904\u7406\uff1f<\/strong><\/p>\n<p>java\u4e2d\uff0c\u4e3b\u52a8\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\u610f\u5473\u7740\u65b9\u6cd5\u7b7e\u540d\u5904\u4e0d\u663e\u5f0f\u58f0\u660e\u629b\u51fa\u5f02\u5e38\u3002\u5f02\u5e38\u53d1\u751f\u65f6\uff0c\u8c03\u7528\u8be5\u65b9\u6cd5\u7684\u65b9\u6cd5\u5e94\u5bf9\u5176\u8fdb\u884c\u5904\u7406\u3002<\/p>\n<p>\u8003\u8651\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre>public int getTotalPages(int rowsPerPage) {\n    \/\/ ...\n    try {\n        \/\/ ...\n    } catch (SQLException e) {\n        e.printStackTrace();\n        throw new RuntimeException(e);\n    }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5f53\u65b9\u6cd5gettotalpages()\u4e3b\u52a8\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\u65f6\uff0c\u5b83\u7684\u8c03\u7528\u8005\uff08\u672c\u4f8b\u4e2d\u4e3amn()\u65b9\u6cd5\uff09\u8d1f\u8d23\u5904\u7406\u8be5\u5f02\u5e38\u3002\u7136\u800c\uff0c\u5728main()\u65b9\u6cd5\u4e2d\u5e76\u672a\u5305\u542b\u5f02\u5e38\u5904\u7406\uff0c\u56e0\u6b64\u5f02\u5e38\u5c06\u88ab\u4f20\u9012\u7ed9java\u865a\u62df\u673a\uff08jvm\uff09\u3002\u6700\u540e\uff0c\u7531jvm\u901a\u8fc7\u8c03\u7528system.err.println()\u6253\u5370\u5f02\u5e38\u5806\u6808\u4fe1\u606f\uff0c\u5e76\u4ee5\u975e\u96f6\u9000\u51fa\u7801\u7ec8\u6b62\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u6839\u636e\u4e1a\u52a1\u903b\u8f91\uff0c\u53ef\u4ee5\u51b3\u5b9a\u5728\u51fa\u73b0\u8fd0\u884c\u65f6\u5f02\u5e38\u65f6\u662f\u5904\u7406\u8fd8\u662f\u7ec8\u6b62\u4e1a\u52a1\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f02\u5e38\u662f\u5e94\u7528\u7a0b\u5e8f\u65e0\u6cd5\u6062\u590d\u7684\u9519\u8bef\uff0c\u5219\u53ef\u4ee5\u5c06\u5176\u4f20\u9012\u7ed9jvm\u5e76\u7ec8\u6b62\u5e94\u7528\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u53ef\u4ee5\u6355\u83b7\u5f02\u5e38\u5e76\u5c1d\u8bd5\u5904\u7406\u5b83\uff0c\u4ee5\u907f\u514d\u5e94\u7528\u7a0b\u5e8f\u5d29\u6e83\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fJava\u4e2d\u4e3b\u52a8\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\uff1a\u8c01\u6765\u5904\u7406\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3b\u52a8\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\uff1a\u65e0\u58f0\u660e\uff0c\u8c01\u5904\u7406\uff1f java\u4e2d\uff0c\u4e3b\u52a8\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\u610f\u5473\u7740\u65b9\u6cd5\u7b7e\u540d\u5904\u4e0d\u663e\u5f0f\u58f0\u660e\u629b\u51fa\u5f02\u5e38\u3002\u5f02\u5e38\u53d1\u751f\u65f6\uff0c\u8c03\u7528\u8be5\u65b9\u6cd5\u7684\u65b9\u6cd5\u5e94\u5bf9\u5176\u8fdb\u884c\u5904\u7406\u3002 \u8003\u8651\u5982\u4e0b\u4ee3\u7801\uff1a public int getTotalPages(int rowsPerPage) { \/\/ &#8230; try { \/\/ &#8230; } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException(e); } } \u767b\u5f55\u540e\u590d\u5236 \u5f53\u65b9\u6cd5gettotalpages()\u4e3b\u52a8\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\u65f6\uff0c\u5b83\u7684\u8c03\u7528\u8005\uff08\u672c\u4f8b\u4e2d\u4e3amn()\u65b9\u6cd5\uff09\u8d1f\u8d23\u5904\u7406\u8be5\u5f02\u5e38\u3002\u7136\u800c\uff0c\u5728main()\u65b9\u6cd5\u4e2d\u5e76\u672a\u5305\u542b\u5f02\u5e38\u5904\u7406\uff0c\u56e0\u6b64\u5f02\u5e38\u5c06\u88ab\u4f20\u9012\u7ed9java\u865a\u62df\u673a\uff08jvm\uff09\u3002\u6700\u540e\uff0c\u7531jvm\u901a\u8fc7\u8c03\u7528system.err.println()\u6253\u5370\u5f02\u5e38\u5806\u6808\u4fe1\u606f\uff0c\u5e76\u4ee5\u975e\u96f6\u9000\u51fa\u7801\u7ec8\u6b62\u5e94\u7528\u7a0b\u5e8f\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u6839\u636e\u4e1a\u52a1\u903b\u8f91\uff0c\u53ef\u4ee5\u51b3\u5b9a\u5728\u51fa\u73b0\u8fd0\u884c\u65f6\u5f02\u5e38\u65f6\u662f\u5904\u7406\u8fd8\u662f\u7ec8\u6b62\u4e1a\u52a1\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f02\u5e38\u662f\u5e94\u7528\u7a0b\u5e8f\u65e0\u6cd5\u6062\u590d\u7684\u9519\u8bef\uff0c\u5219\u53ef\u4ee5\u5c06\u5176\u4f20\u9012\u7ed9jvm\u5e76\u7ec8\u6b62\u5e94\u7528\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u53ef\u4ee5\u6355\u83b7\u5f02\u5e38\u5e76\u5c1d\u8bd5\u5904\u7406\u5b83\uff0c\u4ee5\u907f\u514d\u5e94\u7528\u7a0b\u5e8f\u5d29\u6e83\u3002 \u4ee5\u4e0a\u5c31\u662fJava\u4e2d\u4e3b\u52a8\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38\uff1a\u8c01\u6765\u5904\u7406\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-36108","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=36108"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36108\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=36108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=36108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=36108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}