Java init method
- by Johan Sjöberg
What's a good way to make sure an init method is invoked in java? The alternatives I see are
Don't test it, let the method fail by itself, likely by a NullPointerException
Test if method was initialized or throw
public void foo() {
if (!inited) {
throw new IllegalArgumentException("not initalized");
}
...
}
Delagate…