+ 2

Java Console error

Can anyone please explain why this code is throwing a NullPointerException? https://code.sololearn.com/c9ZxBC4OiVvP/#java I think I know, it's because when I called System.console() the console couldn't be initialized but why is that?

15th Nov 2020, 9:27 PM
pNK
pNK - avatar
1 Answer
+ 2
Martin Taylor ooh I see because there's no console attached makes sense. Thank you for the clear answer!
15th Nov 2020, 9:45 PM
pNK
pNK - avatar