Functional Interface Vs Lambda Expressions:

Once we write Lambda expressions to invoke it's functionality, then Functional Interface is required.
We can use Functional Interface reference to refer Lambda Expression.
Where ever Functional Interface concept is applicable there we can use Lambda Expressions
Ex:1 Without Lambda Expression
1) interface Interf { 
2) public void methodOne();} 

3) public class Demo implements Interf { 
4) public void methodOne() { 
5) System.out.println("method one execution"); 
6) } }
7) public class Test { 
8) public static void main(String[] args) { 
9) Interf i = new Demo(); 
10) i.methodOne(); 
11) } 
12) }

Above code With Lambda expression
1) interface Interf { 
2) public void methodOne(); } 

3) class Test { 
4) public static void main(String[] args) { 
5) Interf i = () -> System.out.println("method one execution"); 
6) i.methodOne(); 
7) } 
8) }

Ex 2: Without Lambda Expression
1) interface Interf { 
2) public void sum(inta,int b); 
3) } 

4) class Demo implements Interf { 
5) public void sum(inta,int b) { 
6) System.out.println("The sum:"+(a+b)); 
7) } 
8) } 

9) public class Test { 
10) public static void main(String[] args) { 
11) Interf i = new Demo(); 
12) i.sum(20,5); 
13) } 
14) }
Above code With Lambda Expression
1) interface Interf { 
2) public void sum(inta, int b); 
3) } 

4) class Test { 
5) public static void main(String[] args) { 
6) Interf i = (a,b) -> System.out.println("The Sum:" +(a+b)); 
7) i.sum(5,10); 
8) } 
9) }

Ex 3: Without Lambda Expressions
1) interface Interf { 
2) public int square(int x); 
3) } 

4) class Demo implements Interf { 
5) public int square(int x) { 
6) return x*x; // OR (int x) -> x*x ;
7) } 
8) } 

9) class Test { 
10) public static void main(String[] args) { 
11) Interf i = new Demo(); 
12) System.out.println("The Square of 7 is: " +i.square(7)); 
13) } 
14) }
Above code with Lambda Expression
1) interface Interf { 
2) public int square(int x); 
3) } 

4) class Test { 
5) public static void main(String[] args) { 
6) Interf i = x -> x*x; 
7) System.out.println("The Square of 5 is:"+i.square(5)); 
8) } 
9) }

Ex 4: Without Lambda expression
1) class MyRunnable implements Runnable { 
2) public void run() { 
3) for(int i=0; i<10; i++) { 
4) System.out.println("Child Thread"); 
5) } 
6) } 
7) } 

8) class ThreadDemo { 
9) public static void main(String[] args) { 
10) Runnable r = new myRunnable(); 
11) Thread t = new Thread(r); 
12) t.start(); 
13) for(int i=0; i<10; i++) { 
14) System.out.println("Main Thread") 
15) } 
16) }
17) }
With Lambda expression
1) class ThreadDemo { 
2) public static void main(String[] args) { 
3) Runnable r = () -> { 
4) for(int i=0; i<10; i++) { 
5) System.out.println("Child Thread"); 
6) } 
7) }; 
8) Thread t = new Thread(r); 
9) t.start(); 
10) for(i=0; i<10; i++) { 
11) System.out.println("Main Thread"); 
12) } 
13) } 
14) }