Java Class New Instance newInstanceHard(String name)

Here you can find the source of newInstanceHard(String name)

Description

new Instance Hard

License

Open Source License

Declaration

public static Object newInstanceHard(String name) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static Object newInstanceHard(String name) {
        try {//from w ww  . j a  va  2  s  .c o  m
            return Class.forName(name).newInstance();
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. newInstanceForClass(Class type)
  2. newInstanceForName(String fullClassName, Object... args)
  3. newInstanceFromClass(final Class clazz)
  4. newInstanceFromClassName(String className, Class classType)
  5. newInstanceFromUnknownArgumentTypes(Class cls, Object[] args)
  6. newInstanceOf(Class clazz)
  7. newInstanceOf(String className)
  8. newInstanceOrThrow(final Class clazz)
  9. newInstancesViaMetaAnnotation(Class declarator, Class metaAnnotationClass, Class expected)