/**
* 创建线程方式一:
* 1、创建:继承Thread+重写run
* 2、启动:创建子类对象+start
* @author 14988
*
*/
public class StartThread extends Thread{
public static void main(String[] args) {
//创建子类对象
StartThread st = new StartThread();
//启动
st.start();
for(int i=1;i<20;i++) {
System.out.println("coding");
}
}
/**
* 线程入口点
*/
public void run() {
for(int i=1;i<20;i++) {
System.out.println("一边听音乐");
}
}
}