Skip to content

Instantly share code, notes, and snippets.

@visparashar
Created March 18, 2018 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save visparashar/82571d925dbb5c39e427d5e0e63e4227 to your computer and use it in GitHub Desktop.
Save visparashar/82571d925dbb5c39e427d5e0e63e4227 to your computer and use it in GitHub Desktop.
@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