{"id":1565,"date":"2020-11-14T09:45:48","date_gmt":"2020-11-14T01:45:48","guid":{"rendered":"https:\/\/www.yusian.com\/blog\/?p=1565"},"modified":"2020-11-14T09:45:48","modified_gmt":"2020-11-14T01:45:48","slug":"java%e5%a4%9a%e7%ba%bf%e7%a8%8b%e7%9a%84%e4%b8%89%e7%a7%8d%e5%bc%80%e5%90%af%e6%96%b9%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/java\/2020\/11\/14\/0945481565.html","title":{"rendered":"Java\u591a\u7ebf\u7a0b\u7684\u4e09\u79cd\u5f00\u542f\u65b9\u5f0f"},"content":{"rendered":"<ol>\n<li>\u7ee7\u627f\u81ea<code>Thread<\/code>\u91cd\u5199<code>run<\/code>\u65b9\u6cd5\n<pre><code class=\"language-java line-numbers\"> public class MyThread extends Thread {\n\n     @Override\n     public void run() {\n         System.out.println(getName());\n         String name = getName();\n         for (int i = 0; i &lt; 20; i++) {\n             System.out.println(name + \"---\" + i);\n         }\n     }\n }\n<\/code><\/pre>\n<\/li>\n<li>\u5b9e\u73b0<code>Runable<\/code>\u63a5\u53e3\u53ca<code>run<\/code>\u65b9\u6cd5\n<pre><code class=\"language-java line-numbers\"> public class RunableImp implements Runnable {\n\n     @Override\n     public void run() {\n         String name = Thread.currentThread().getName();\n         for (int i = 0; i &lt; 20; i++) {\n             System.out.println(name + \"---\" + i);\n         }\n     }\n }\n<\/code><\/pre>\n<\/li>\n<li>\u533f\u540d\u5185\u90e8\u7c7b\u5b9e\u73b0<code>run<\/code>\u65b9\u6cd5\n<pre><code class=\"language-java line-numbers\"> \/\/ Runable\u533f\u540d\n Thread thread1 = new Thread(new Runnable() {\n     @Override\n     public void run() {\n         String name = Thread.currentThread().getName();\n         for (int i = 0; i &lt; 20; i++) {\n             System.out.println(name + \"---\" + i);\n         }\n     }\n });\n thread1.start();\n \/\/ Thread\u533f\u540d\n new Thread() {\n     @Override\n     public void run() {\n         String name = Thread.currentThread().getName();\n         for (int i = 0; i &lt; 20; i++) {\n             System.out.println(name + \"---\" + i);\n         }\n     }\n }.start();\n<\/code><\/pre>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u7ee7\u627f\u81eaThread\u91cd\u5199run\u65b9\u6cd5 public class MyThread extends Thread { @Override public void run() { System.out.println(getName()); String name = getName(); for (int i = 0; i &lt; 20; i++) { System.out.println(name + &#8220;&#8212;&#8221; + i); } } } \u5b9e\u73b0Runable\u63a5\u53e3\u53carun\u65b9\u6cd5 public class RunableImp implements Runnable { @Override public void run() { String name = Thread.currentThread().getName(); for (int i = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[34,252,251,192],"class_list":["post-1565","post","type-post","status-publish","format-standard","hentry","category-java","tag-java","tag-runnable","tag-thread","tag-192"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1565","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=1565"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1565\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=1565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=1565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=1565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}