Created
March 18, 2018 06:59
-
-
Save visparashar/82571d925dbb5c39e427d5e0e63e4227 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FunctionalInterface //optional | |
interface MyInterface{ | |
public void myMethod(); | |
} | |
public class LambdaExpressionEx{ | |
public static void main(String args[]) | |
{ | |
int variable = 10; | |
//implemenmtation without lambda expression | |
MyInterface myInterface = new MyInterface(){ | |
public void myMethod(){ | |
System.out.println("variable = "+variable);} | |
}; | |
myInterface.myMethod(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment