Create new instance
T newInstance()
- Creates a new instance of the class represented by this Class object.
public class Main {
public static void main(String[] args) {
Class c = new String().getClass();
try {
Object obj = c.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}