new
expression with an empty argument list. The class is initialized if it has not already been initialized. Note that this method propagates any exception thrown by the nullary constructor, including a checked exception. Use of this method effectively bypasses the compile-time exception checking that would otherwise be performed by the compiler. The {@link java.lang.reflect.Constructor#newInstance(java.lang.Object) Constructor.newInstance} method avoids this problem by wrappingany exception thrown by the constructor in a (checked) {@link java.lang.reflect.InvocationTargetException}.
@return a newly allocated instance of the class represented by thisobject.
@exception IllegalAccessException if the class or its nullary constructor is not accessible.
@exception InstantiationException if this Class
represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.
@exception ExceptionInInitializerError if the initializationprovoked by this method fails.
@exception SecurityException If a security manager, s, is present and any of the following conditions is met:
|
|