public class Test {
public static void main(String[] args){
//通过lambda表达式实现
new Thread(
()-> System.out.println("this is test1" )
).start();
//接口和实现类(匿名内部类)实现
new Thread(new Runnable() {
@Override
public void run() {
System.out.println("this is test2" );
}
}).start();
}
}
网友评论