Skip to content

Commit 477bfa7

Browse files
committed
added lamda code sample
1 parent 27bb83e commit 477bfa7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package java8.lambda;
2+
/**
3+
*
4+
* @author saurav
5+
*
6+
*/
7+
public class LambdaDemo4
8+
{
9+
private int add(int x,int y)
10+
{
11+
return x+y;
12+
}
13+
public static void main(String[] args)
14+
{
15+
// Reference to an instance method.
16+
Calculator calc=new LambdaDemo4()::add;
17+
System.out.println(calc.add(10,10)); // output : 20
18+
}
19+
}

0 commit comments

Comments
 (0)