public static boolean hasDefaultConstructor ( Class < ? > cls ) { if ( cls == null ) { return false ; } try { cls . getConstructor ( new Class < ? > [ 0 ] ) ; } catch ( NoSuchMethodException e2 ) { return false ; } catch ( SecurityException e2 ) { throw new IllegalArgumentException ( e2 . getMessage ( ) , e2 ) ; } return true ; }
To test class if has default constructor method