CJCoding With Joseph
15free / daySign inCreate account

The variable text is set to null. Reading text.Length on a null reference throws a NullReferenceException. Catch it and print exactly Cannot read a null reference. Use top-level statements with try/catch. This program reads no input.

The program always prints: Cannot read a null reference

Expected output

Cannot read a null reference

= newline. The output ends with a newline, so print one after the last line.

Hints3 available
Topics
Exceptions
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.