Exceptions From Constructors

at 2006-09-18 in Further reading by friebe (0 comments)

Found the following while scanning throught the JavaSpecialists newsletter archive:

What is the best way to deal with objects that cannot be properly instantiated?

  1. Ignore the problem and cause errors when you try to use the object later on
  2. Throw a checked exception
  3. Throw an IllegalArgumentException
  4. Throw a NullPointerException
  5. Throw an AssertionError
  6. Put in a Java 1.4 assertion

Read the full article here.



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases
5.8-SERIES
Unicode
Language
5.9-SERIES

Related

Find related articles by a search for «Exceptions».