Checked exception in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Checked exception in java

Can someone please give an example of "default throw and default catch" for checked exception.

29th Jun 2018, 12:07 AM
harshit
harshit - avatar
3 Answers
+ 4
Try this: https://code.sololearn.com/c8u1ZxXjQg3E It catches all exceptions. nextInt generates a couple exceptions demostrated by first two test cases. The third test case uses the throw for being out of range. The fourth test case runs sucessfully. Each of the following lines is a unique test case that you should enter to the input prompt individually: no input (just submit) a 0 5
29th Jun 2018, 1:19 AM
John Wells
John Wells - avatar
+ 1
No I think this example is for unchecked exception as it has IllegalArgumentException which is a type of unchecked exception. I am asking for checked exception example (like IOException) in case of "default throw and default catch). I know an example of https://code.sololearn.com/cCbC2dVDif1F/?ref=app
29th Jun 2018, 2:59 PM
harshit
harshit - avatar
0
thanks
29th Jun 2018, 11:19 AM
harshit
harshit - avatar