1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| package com.sympa.lesson01;
public class lambda01 {
static class Lambda2 implements Love{ @Override public void lambda() { System.out.println("lambda2");
} }
public static void main(String[] args){
Love lam = new Lambda1();
class Lambda3 implements Love{ @Override public void lambda() { System.out.println("lambda3"); } }
lam = new Love(){ @Override public void lambda() { System.out.println("lambda4"); } };
lam = () -> { System.out.println("lambda5"); }; } }
interface Love{ void lambda(); }
class Lambda1 implements Love{ @Override public void lambda() { System.out.println("lambda1"); } }
|