文章目录 继承Thread 实现Runnable接口 获取线程的名称 线程休眠 继承Thread public class MyThread extends Thread{ @Override public void run() { for (int i = 0; i < 10; i++) { System.out.println("床前明月光"+i); } } } public class Demo1 { public static void main(String[] args) { MyThread thread = new MyThread(); thread.start(); for (