자바7 메소드 레퍼런스 Greeting 클래스 public class Greeting { private String name; public String getName() { return name; } public Greeting(){ } public Greeting(String name){ this.name = name; } public String hello(String name){ return "hello " + name; } public static String hi(String name){ return "hi " + name; } } static 메서드 참조하는 경우 :: 이용 public class Java8to11Application { public static void main(String[] args) { // .. 2022. 3. 26. 람다 표현식 private void run() { final int num = 10; // 로컬 클래스 class LocalClass{ void printNum(){ System.out.println(num); } } // 익명 클래스 Consumer integerConsumer = new Consumer() { @Override public void accept(Integer integer) { System.out.println(num); } }; // 람다 IntConsumer printInt = (i) ->{ System.out.println(i); }; } private void run() { // run() scope의 num int num = 10; // 로컬 클래스 class LocalClass{ voi.. 2022. 3. 26. 이전 1 2 다음