This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am learning to use the Eclipse IDE. I am using the console class to get an input. While running the program, I give the console input using the "Arguments\Program Arguments" tab. However I am still getting NPE. Do I need to do anything else? The programs runs fine as a text file.
System.console() only returns a non-null value if you run the application from an actual command line. IDEs like Eclipse don't have one, they just mimic one. However, that means that System.console() returns null. You can't prevent that. You'll just have to test your application from a good-old command prompt window.