...
A third solution is to provide a non-empty private
constructor accessible only from within the class. This solution is not susceptible to reflection based attacks originating from unprivileged code since the AccessibleObject.setAccessible()
method requires a security manager check by default.
Code Block | ||
---|---|---|
| ||
class BankOperation { private BankOperation() { // ... } } |
...