Multiple Choice
Why does the following code cause a compiler error?
Try
{
Number = Integer.parseInt(str) ;
}
Catch (IllegalArgumentException e)
{
System.out.println("Bad number format.") ;
}
Catch (NumberFormatException e)
{
System.out.println(str + " is not a number.") ;
}
A) Because you can have only one catch clause in a try statement
B) Because NumberFormatException inherits from IllegalArgumentException. The code should handle NumberFormatException before IllegalArgumentException
C) Because the Integer.parseInt method does not throw a NumberFormatException
D) Because the Integer.parseInt method does not throw an IllegalArgumentException
Correct Answer:

Verified
Correct Answer:
Verified
Q1: To serialize an object and write it
Q3: If, within one try statement you want
Q5: What will be the result of the
Q6: The exception classes are in packages in
Q7: In order for an object to be
Q8: When an exception is thrown:<br>A) it must
Q9: A class must implement the Serializable interface
Q10: In a catch statement, what does the
Q11: When an exception is thrown by code
Q19: If the class SerializedClass contains references to