Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2013
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. public class Main {
  2.  
  3.     private interface Delegate { void execute(String str); }
  4.  
  5.     private static void delegateCaller(Delegate delegate) {
  6.         delegate.execute("Hello world");
  7.     }
  8.  
  9.     public static void main(String[] args) {
  10.         delegateCaller(new Delegate() {
  11.             @Override
  12.             public void execute(String str) {
  13.                 System.out.println(str);
  14.             }
  15.         });
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement