1、实现Runnable接口
class Thread_ implements Runnable{
public void run() {
System.out.println("run++++++++++++++++");
}
}
//创建对象
Thread_ t=new Thread_();
Thread thread=new Thread(t);
//启动
thread.start();
2、继承Thread类:
class Thread_ extends Thread{
public void run() {
System.out.println("run++++++++++++++++");
}
}
Thread_ t=new Thread_();
t..start();