You mean something like this:
public <T> T someFunction(Class<T> clazz, String textFile) throws Throwable { return clazz.newInstance(); }
The above code will use the no-arguments constructor of the class (if any).
If your class should be created using a specific constructor, you can run the following example:
public <T> T someFunction(Class<T> clazz, String textFile) throws Throwable {
Shivan dragon
source share