private boolean isUnequivocallyInstantiable(Class<?> clazz) {
    if (clazz.isInterface()) {
      return false;
    }
    // checking for constructors would be more elegant, but in
    // classes without any declared constructors, Class.getConstructor()
    // returns null.
    Object o;
    try {
      o = clazz.getDeclaredConstructor().newInstance();
      if (o != null) {
        return true;
      } else {
        return false;
      }
    } catch (InstantiationException e) {
      return false;
    } catch (IllegalAccessException e) {
      return false;
    } catch (NoSuchMethodException e) {
      return false;
    } catch (InvocationTargetException e) {
      return false;
    }
  }
private boolean isUnequivocallyInstantiable(Class<?> clazz) {
    if (clazz.isInterface()) {
      return false;
    }
    
    
    
    Object o;
    try {
      o = clazz.getDeclaredConstructor().newInstance();
      if (o != null) {
        return true;
      } else {
        return false;
      }
    } catch (InstantiationException e) {
      return false;
    } catch (IllegalAccessException e) {
      return false;
    } catch (NoSuchMethodException e) {
      return false;
    } catch (InvocationTargetException e) {
      return false;
    }
  }
private boolean isUnequivocallyInstantiable ( Class < ? > clazz ) { if ( clazz . isInterface ( ) ) { return false ; } // checking for constructors would be more elegant, but in // classes without any declared constructors, Class.getConstructor() // returns null. Object o ; try { o = clazz . getDeclaredConstructor ( ) . newInstance ( ) ; if ( o != null ) { return true ; } else { return false ; } } catch ( InstantiationException e ) { return false ; } catch ( IllegalAccessException e ) { return false ; } catch ( NoSuchMethodException e ) { return false ; } catch ( InvocationTargetException e ) { return false ; } }
Can the given clazz instantiable with certainty?

@param clazz
The class to test for instantiability
@return true if clazz can be instantiated, and false otherwise.
Can the given clazz instantiable with certainty?