This programming assignment involves learning about some common exceptions which occur in Java programs. Consider the following exception types:
NullPointerException
ArrayIndexOutOfBoundsException
ClassCastException
IllegalArgumentException
Research what each exception type means and the conditions under which each occurs (thrown). Then write the following programs, one for each of the above-listed exception types:
- A program which throws the exception (with a throw statement) and catches it displaying unique information about the exception. Name your programs <exception>Thrown.java <exception> is the name of the exception involved for example NullPointerExceptionThrown.java.
- A program which causes the exception to be thrown (not with a throw statement) and catches it displaying unique information about the exception (ex. Name of class and method causing the exception). For example, for the NullPointerException, have your program create a situation which would cause this exception to be thrown. Name your programs <exception>Catch.java <exception> is the name of the exception involved for example NullPointerExceptionCatch.java.
At the end you should have eight programs, four <exception>Thrown.java and four <exception>Catch.java. All files should be in the same directory.
Submit the source code in a zip file named as follows: Assignment9_ followed by your first name initial, followed by your last name, followed by your course section number. For example, if your name is Jane Smith and you are in section 81, your zip files name would be Assignment9_jsmith81.zip.
Reviews
There are no reviews yet.