SHARE
TWEET

Untitled

a guest Jun 17th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class LambdaExpressions {
  2.  
  3.     interface Foo {
  4.         void bar(Object o);
  5.     }
  6.  
  7.     static void doo(Foo f) {
  8.         f.bar("baz");
  9.     }
  10.  
  11.     public static void main(String[] args) {
  12.  
  13.         doo( x -> {System.out.println(x);});
  14.     }
  15.  
  16. }
  17.      
  18. new Foo() {
  19.     @Override
  20.     public void bar(Object x) {
  21.         System.out.println(x);
  22.     }
  23. }
  24.      
  25. public static void main(String[] args) {
  26.     Foo f = new Foo() {
  27.         @Override
  28.         public void bar(Object x) {
  29.             System.out.println(x);
  30.         }
  31.     };
  32.  
  33.     f.bar("baz");
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top