IGN評《孤島驚魂》史上十佳作品 《孤島驚魂6》排第三
阿新 • • 發佈:2021-11-26
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(); } }