Catch me if you can - 1

"Hi, Amigo. Here are some interesting tasks that involve catching exceptions."

undefined
15
Task
New Java Syntax, level 15, lesson 6
Locked
Exception when working with numbers
Catch the exception that occurs when the following code is executed: int a = 42 / 0; Display the type of exception caught.
undefined
15
Task
New Java Syntax, level 15, lesson 6
Locked
Exception while working with strings
Catch (and display the type of) the exception that occurs when the following code is executed: String s = null; String m = s.toLowerCase();
undefined
15
Task
New Java Syntax, level 15, lesson 6
Locked
Exception when working with arrays
Catch the exception that occurs when the following code is executed: array[8] = 5; Display the exception on the screen using any means (the output must contain the type of the exception thrown).
undefined
15
Task
New Java Syntax, level 15, lesson 6
Locked
Exception when working with List collections
Catch the exception that occurs when the following code is executed: String s = list.get(18); Display the exception on the screen using any means (the output must contain the type of the exception thrown).
undefined
15
Task
New Java Syntax, level 15, lesson 6
Locked
Exception when working with Map collections
Catch the exception that occurs when the following code is executed: HashMap map = new HashMap(null); Display the exception on the screen using any means (the output must contain the type of the exception thrown).
undefined
15
Task
New Java Syntax, level 15, lesson 6
Locked
Exception when working with numbers
Catch the exception that occurs when the following code is executed: int num = Integer.parseInt("XYZ"); Display the exception on the screen using any means (the output must contain the type of the exception thrown).

"Here's a tip: write your program, see what sort of exceptions occur, and then change the code to catch them."