Skip to content

Instantly share code, notes, and snippets.

@Sitwon
Created May 18, 2010 19:08
Show Gist options
  • Save Sitwon/405387 to your computer and use it in GitHub Desktop.
Save Sitwon/405387 to your computer and use it in GitHub Desktop.
abstract class Lambda {
abstract public void func();
}
public class Example {
public static void main(String args[]) {
System.out.println("Begin main");
final String hello = "Hello World!";
functionCall(new Lambda() {
public void func() {
System.out.println("First lambda");
}
});
functionCall(new Lambda() {
public void func() {
System.out.println("Main's 'hello': " + hello);
}
});
System.out.println("End main");
}
static void functionCall(Lambda l) {
System.out.println("function start");
l.func();
System.out.println("function end");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment