Skip to content

Instantly share code, notes, and snippets.

@Fonsan
Created September 3, 2012 15:09
Show Gist options
  • Save Fonsan/3609967 to your computer and use it in GitHub Desktop.
Save Fonsan/3609967 to your computer and use it in GitHub Desktop.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package hello;
import javax.swing.JFrame;
import javax.swing.JLabel;
/**
*
* @author fonsan
*/
public class Hello {
interface MyInterface {
void callback();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
MyInterface callback = new MyInterface() {
@Override
public void callback() {
System.out.println("hej");
}
};
function() {}
->
doSomethingAsync(callback);
}
static void doSomethingAsync(MyInterface mi) {
mi.callback();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment