package com.cppdy;
 
//通过实现Runnable接口实现多线程
class MyThread1 implements Runnable{
 
    @Override
    public void run() {
        for (int i = 0; i < 30; i++) {
            System.out.println("线程打印:"+i);
        }
    }
 
}
 
public class ThreadDemo1 {
 
    public static void main(String[] args) {
        System.out.println("主函数启动");
        MyThread1 mt=new MyThread1();
        Thread thread = new Thread(mt);
        thread.start();
        for (int i = 0; i < 30; i++) {
            System.out.println("主函数打印:"+i);
        }
        System.out.println("主函数结束");
    }
 
}