Advertisement
Evyatar12

Celebration Method

Mar 26th, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. void playCelebration(String celebrationName) {
  2.         celebrationName = "play" + celebrationName.replaceAll(" ", "");
  3.        
  4.         try {
  5.             Method method = getClass().getMethod(celebrationName);
  6.             method.invoke(this);
  7.         } catch (NoSuchMethodException | SecurityException |
  8.                 IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
  9.             e.printStackTrace();
  10.         }
  11.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement