Skip to content

Commit 1644f75

Browse files
authored
Create JavaLambdaEx3.java
1 parent 7c55cde commit 1644f75

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

lambda/JavaLambdaEx3.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.zetcode;
2+
3+
@FunctionalInterface
4+
interface Addition {
5+
6+
public int add(int a, int b);
7+
}
8+
9+
public class JavaLambdaEx3 {
10+
11+
public static void main(String[] args) {
12+
13+
14+
Addition addition = (x, y) -> (x + y);
15+
16+
System.out.println(addition.add(4, 5));
17+
System.out.println(addition.add(5, 5));
18+
System.out.println(addition.add(6, 6));
19+
20+
}
21+
}

0 commit comments

Comments
 (0)