using lambda expression

Home   »   using lambda expression

@FunctionalInterface  //It is optional  
interface Table{  
    public void draw();  
}  
  
public class Demo2 {  
    public static void main(String[] args) {  
        int length=10;  
          
        //with lambda  
        Table d2=()->{  
            System.out.println("Drawing "+length);  
        };  
        d2.draw();  
    }  
}  

Leave a Reply

Your email address will not be published. Required fields are marked *