/**
1.创建线程的方法,通过实现接口
*/
public class MyThread implements Runnable{
//设置线程之间的共享的数据
private static int staticcount=1000;
//线程中的实现接口必须实现的接口
public void run(){
System.out.println("new thread");
}
public static void main(String[] args){
//创建线程
Thread th=new Thread(new MyThread());
//开启线程
th.run();
}
}
1.创建线程的方法,通过实现接口
*/
public class MyThread implements Runnable{
//设置线程之间的共享的数据
private static int staticcount=1000;
//线程中的实现接口必须实现的接口
public void run(){
System.out.println("new thread");
}
public static void main(String[] args){
//创建线程
Thread th=new Thread(new MyThread());
//开启线程
th.run();
}
}