美文网首页
lambda表达式

lambda表达式

作者: 用户zzzzzz | 来源:发表于2022-08-29 10:28 被阅读0次
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();

    }
}

相关文章

网友评论

      本文标题:lambda表达式

      本文链接:https://www.haomeiwen.com/subject/jajlnrtx.html