I have a constructor that takes a String argument. I'd like to throw an
exception if the constructor is invoked with a null argument, but I'm
not sure which instruction I should use.
NullPointerException is technically accurate, since it is a null
pointer, but it is also an IllegalArgumentException. I think that
IllegalArgumentException is more specific, so I'll probably go with
that, but wanted opinions.
The third option is AssertionError. I could just use assert arg!=null,
and that could be enough. This is for a personal project, so it doesn't
*really* matter, but at the same time its good practice for me to think
about these sort of things
Thoughts?