Solution 7 B
Solution 7 B
The code above is the constructor for NewGreeter adjusted to handle a NullPointerException. Note that although it is actually the class TestNewGreeter that is normally responsible for executing the System.exit(0); instruction, when an exception is thrown the responsibility for terminating code execution safely passes to NewGreeter, because code execution will not be returned to TestNewGreeter after the exception is thrown.
© G. Hearn, & University of the Western Cape, 2006
Copyright 2007-2008,
by the Contributing Authors.
Cite/attribute Resource.
Solution 7 B. (2008, July 16). Retrieved May 26, 2013, from UWC Free Courseware Web site: http://free.uwc.ac.za/freecourseware/information-systems/java-platform-introduction/solutions/solution-7-b.
This work is licensed under a
Creative Commons License : Attribution-ShareAlike 3.0.






