โ Back to Exceptions
Question 676
Print the Exception Type Name
Print the Exception Type Name
Read an integer and printValue: <n>. If parsing fails, catch the exception and print the name of its type usingex.GetType().Name(which prints exactlyFormatExceptionfor bad input). Use top-level statements withtry/catch. Input7prints: Value: 7 Inputbadprints: FormatException
Expected Output:
Value: 7
Topics:
Exceptions
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.