Lambda

package com.student_thread.lambda;
public class Lambda {
        //3.静态内部类
        static class Like2 implements ILike{
            @Override
            public void Lambda() {
                System.out.println("I STUDENT LAMBDA PART TWO");
            }
        }


        public static void main(String[] args) {

            ILike like=new Like();
            like.Lambda();

            like = new Like2();
            like.Lambda();

            //4.局部内部类
            class Like3 implements ILike{
                @Override
                public void Lambda() {
                    System.out.println("I STUDENT LAMBDA PART THREE");
                }
            }
            like = new Like3();
            like.Lambda();

            //5.匿名内部类
            like =new ILike(){
                @Override
                public void Lambda() {
                    System.out.println("I STUDENT LAMBDA PART FOUR");
                }
            };
            like.Lambda();

            //6.用lambda简化测试
            like=()->{
                System.out.println("I STUDENT LAMBDA PART FIVE");
            };
            like.Lambda();



        }


    static class Like implements ILike{
        @Override
        public void Lambda(){
            System.out.println("LAMBDA PART ONE");
        }
    }

    interface ILike{
        void Lambda();
    }

}

 

上一篇:回归分析06:回归参数的估计(4)


下一篇:【题解】Luogu5211 / LOJ 2572 / UOJ 296 [ZJOI2017] 字符串