public String toString() {
    try {
      // Invoke the static toString() method of the player class 
      Method displayNameField = playerClass.getMethod("getType", (Class[]) null);
      Player player = (Player) playerClass.newInstance();
      return (String) displayNameField.invoke(player, (Object[]) null);
    }
    catch (IllegalAccessException ex) {
      ex.printStackTrace();
      throw new RuntimeException(ex);
    }
    catch (IllegalArgumentException ex) {
      ex.printStackTrace();
      throw ex;
    }
    catch (InstantiationException ex) {
      // The player couldn't be instantiated
      ex.printStackTrace();
      throw new RuntimeException(ex);
    }
    catch (InvocationTargetException ex) {
      // Problem calling the getType() method on the player
      ex.printStackTrace();
      throw new RuntimeException(ex);
    }
    catch (NoSuchMethodException ex) {
      // The given player class doesn't have a getType() method.
      // This should never happen if the class is an instance of Player.
      ex.printStackTrace();
      throw new RuntimeException(ex);
    }
    catch (SecurityException ex) {
      ex.printStackTrace();
      throw ex;
    }
  }