Advertisement
Dennis07

Untitled

Jun 26th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public static void main(String[] args) {
  2.         Object o = new Object() { public String s(String name) { return "Hello, " + name; } };
  3.             try {
  4.                 System.out.println(((String) o.getClass().getDeclaredMethod("s", String.class).invoke(o, "Dennis")));
  5.             } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
  6.                     | NoSuchMethodException | SecurityException e) {
  7.                 e.printStackTrace();
  8.             }
  9.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement