console.readLine throws NullPointerException when code is run in Eclipse IDE.
I just tried to run the code in Eclipse but when I do, Eclipse always throws a null pointer exception for the console.readLine(); , does this method cannot be applied on eclipse ? thank you
Manish Giri16,266 Points
I think console.readLine() returns NULL when you use it from an IDE, Eclipse in this case. Hence you get a Null Pointer Exception, when you try to do something with the result.
Run the same code from the command line/terminal and see what you get.