Skip to content

Instantly share code, notes, and snippets.

@yardfarmer
Last active October 4, 2015 16:36
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 yardfarmer/a2a0758646c4ea16ddbf to your computer and use it in GitHub Desktop.
Save yardfarmer/a2a0758646c4ea16ddbf to your computer and use it in GitHub Desktop.
public class Lalala {
public static void main(String[] args) {
new Runnable() {
public void run() {
System.out.println("runnable.");
}
}.run();
// 好想 js 命名函数
int i = 0;
Runnable r =()->{
System.out.println("lambada");
// i =2; // 在闭包作用域中的本地变量,不能被修改
};
r.run();
r.run();
Action login = (String content)->{
System.out.println(content);
};
login.execute("abcd");
}
}
interface Action {
void execute(String s);
}
@yardfarmer
Copy link
Author

Lamada 的用法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment