20) Fill in the code below in the underline: ``` public class Test { public static void main(String[] args) { Test test = new Test(); test.setAction(________); } public void setAction(T1 t) { t.m(); } } interface T1 { public void m(); } ``` A) System.out.print("Action 1! ") B) (e) -> {System.out.print("Action 1! ")} **C) () -> System.out.print("Action 1! ")** D) (e) -> System.out.print("Action 1! ") 내부 클래스보다 줄어든게 내부 익명 클래스이고 내부 익명 클래스보다 줄어든게 람다식으로 알고 있는데요. 이 문제를 무엇을 물어보는 지 조차 잘 이해가 되지 않습니다 ;;;
# 람다식 ## 요약 람다식이란 식별자 없이 표현 가능한 함수 표현 식입니다. ## 형식 아래와 같은 형식으로 작성이 가능합니다. ``` ( parameters ) -> expression body ( parameters ) -> { expression body } () -> { expression body } () -> expression body ... ``` ## 익명 클래스 또는 익명 인터페이스를 대체 람다식을 사용하면 불필요한 코드들을 줄여 개발시간을 단축 할 수 있습니다. ``` // default class A implements Runnable { @Override public void run() { System.out.println("Hello World."); } } A a = new A(); new Thread(a).start(); // Thread - traditional new Thread(new Runnable() { @Override public void run() { System.out.println("Hello World."); } }).start(); // using lambda // Thread - Lambda Expression new Thread(()->{ System.out.println("Hello World."); }).start(); ``` ## 참조 + http://jdm.kr/blog/181