Creating instances Constructor Checker
Implement checkPublicParameterlessConstructor that returns true if the provided class declares public parameterless constructor and false otherwise.
/**
* Check whether the class declares public parameterless constructor
*/
class ConstructorChecker {
public boolean checkPublicParameterlessConstructor(Class<?> clazz) {
try {
clazz.getConstructor();
return true;
} catch (NoSuchMethodException e) {
return false;
}
}
}

浙公网安备 33010602011771号