package colllection;
public class TestThread {
public static void main (String []args){
Thread t1=new Thread(){//相当于继承Thread覆盖run方法
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("使用匿名内部类创建线程");
}
};
t1.start();
System.out.println(111);
Runnable runanble=new Runnable() {//实现runnable创建线程 相当于 A immpents Runnable
//然后把 A a 作为参数传过去
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("实现runnable创建线程");
}
};
Thread t2=new Thread(runanble);
t2.start();
}
}