Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Sina Maleki
6,135 Pointsproblem in IDE
Hi guys, I used below code in eclipse but I've got "java.lang.NullPointerException" error, Does someone know how to resolve it?
Console console = System.console();
String letter = console.readLine("Enter Your Guess: ");
1 Answer
Seth Kroger
56,416 PointsEclipse and IntelliJ have issues with java.io.Console. You need to use System.in and System.out instead. System.out works virtually the same as Console for output but for input you need to open a BufferedReader first:
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
System.out.printf("Make a guess: ");
String guess = bufferedReader.readLine();