Task 4 of 7 · 0 solved · 7 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

(Optional) 6.5 Exceptions — parse or default

Total: 0 / 3 pts
Practice mode — check each part and get hints as you go.
Task

Fill in parseOrDefault so that it returns the number in the string, or def when the string is not a number.

The program prints 42 and then -1.

Your solution