Where is an exception

Report a typo

Examine the following code snippet:

String s = "ten";            // 1
int n = Integer.parseInt(s); // 2
System.out.println(n);       // 3
n += 20;                     // 4
System.out.println(n);       // 5

Enter the number of the line that will throw a NumberFormatException.

If you think that each line is OK and the code is correct, enter "0"

Enter a number
___

Create a free account to access the full topic