1 When must your code use a throws clause and where is it c
1) When must your code use a throws clause, ______________________________
and where is it coded? _____________________________________________
2) Give the minimum code necessary to define an unchecked exception class called IllegalIntegerException.
3) Give all the code to throw an exception object in the class: IllegalIntegerException.
Solution
1) When must your code use a throws clause, when following method not handling the exception then it should use throws clause to throw an exception.
and where is it coded? it is coded after the method which is not willing to handle the exception.
ex:
public void wait() throws NumberFormatException
{
int i,a=5,b=0;
i=a/b;
}
