CJCoding With Joseph

Argument Cannot Be Null

Read an id. If id is 1 the name is Alice, otherwise the name is null. If the name is null, throw new ArgumentNullException(nameof(name), "name not found"). Otherwise print Name: <name>. Catch the ArgumentNullException and print exactly Error: name not found. Use top-level statements with try/catch.

Input 1 prints: Name: Alice
Input 2 prints: Error: name not found

Expected Output:

Name: Alice
Topics:
Exceptions
๐Ÿ“ฅ Auto-Input:
1\n
This input is automatically fed to your program's stdin
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.