有什么区别么?是不是都要调用Runnable接口的run()方法?
- class Runner implements Runnable{
-
- @Override
- public void run() {
- System.out.println("Run begin");
- }
-
- }
- public class TestStartAndRun {
-
- public static void main(String[] args) {
- Runner r = new Runner();
- Thread t = new Thread(r);
- r.run(); //这两个方法有什么区别?
- t.start(); //这两个方法有什么区别?
- }
- }
复制代码 |