Browse Source

람다식 추가

tobby48 6 years ago
parent
commit
b211c7343c

+ 18
- 0
src/kr/co/swh/lecture/java/scene4/LamdaInterface.java View File

@@ -0,0 +1,18 @@
1
+package kr.co.swh.lecture.java.scene4;
2
+
3
+/**
4
+ * <pre>
5
+ * kr.co.swh.lecture.java.scene4 
6
+ * LamdaInterface.java
7
+ *
8
+ * 설명 :	람다 함수형 인터페이스
9
+ * </pre>
10
+ * 
11
+ * @since : 2019. 3. 13.
12
+ * @author : tobby48
13
+ * @version : v1.0
14
+ */
15
+@FunctionalInterface
16
+interface LamdaInterface {
17
+	public int sum(int x, int y);
18
+}

+ 21
- 0
src/kr/co/swh/lecture/java/scene4/LamdaMain.java View File

@@ -0,0 +1,21 @@
1
+package kr.co.swh.lecture.java.scene4;
2
+
3
+/**
4
+ * <pre>
5
+ * kr.co.swh.lecture.java.scene4 
6
+ * PlusAnnotationMain.java
7
+ *
8
+ * 설명 :	람다 표현식 메인
9
+ * </pre>
10
+ * 
11
+ * @since : 2019. 3. 13.
12
+ * @author : tobby48
13
+ * @version : v1.0
14
+ */
15
+public class LamdaMain {
16
+	public static void main(String[] args) {
17
+		LamdaInterface add = (int x, int y) -> x + y;
18
+		int value = add.sum(2,3);
19
+		System.out.println(value);
20
+    }
21
+}