package com.seven.线程;
/** 创建线程的第一个方式
* 继承Thread类
* 覆盖里面的run方法
* 把共享代码写入
*/
public class Thread1 extends Thread{
public void run(){
for(int x=0; x<60; x++){
System.out.println("demo run方法"+x);
}
}
}
/*
* 创建两个线程
* 执行里面的start();方法
*
*/
public class Thread2 {
public static void main(String[] args) {
Thread1 threand = new Thread1();
Thread1 threand1 = new Thread1();
threand1.start();
for(int x=0; x<60 ; x++){
System.out.println("ssss ma "+x);
}
threand.start();;
for(int x=0; x<60 ; x++){
System.out.println("nihao ma "+x);
}
for(int x=0; x<60 ; x++){
System.out.println("nihao ma "+x);
}
}