多线程学习
2021-04-24 13:26
标签:nbsp new t 继承 call stat read bsp str override 一、线程的创建 1、继承thread类 public class MyThread extends Thread { 2、实现runnable接口 无返回值 public class MyThread3 implements Runnable { 3、实现callable接口 有返回值 多线程学习 标签:nbsp new t 继承 call stat read bsp str override 原文地址:https://www.cnblogs.com/871212nyl/p/13263594.html
@Override
public void run() {
for (int i = 0; i System.out.println("我在学习线程问题1......");
}
}
public static void main(String[] args) {
MyThread myThread = new MyThread();
myThread.start();
for (int i = 0; i System.out.println("我在学习线程问题");
}
}
}
@Override
public void run() {
for (int i = 0; i System.out.println("我在学习线程问题1......");
}
}
public static void main(String[] args) {
MyThread3 myThread3 = new MyThread3();
Thread thread = new Thread(myThread3);
thread.start();
for (int i = 0; i System.out.println("我在学习线程问题");
}
}
}