code: public static <T> T newInstance(Class<T> cl) {
      try {
        return cl.getDeclaredConstructor().newInstance();
      } catch (InstantiationException | IllegalAccessException | NoSuchMethodException
          | InvocationTargetException e) {
        throw new RuntimeException(e);
      }
    }
docs: Create a new instance of a class
  
  @param cl The class object.
  @param <T> The class type.
  @return New class instance.