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
ad cg
179 PointsJava Console Object
When I declare console object in "inteliJ idea" it shows a null pointer exception Console console = System.console();
1 Answer
Jeremiah Bushau
24,061 Pointsyes, I also discovered this. Apparently,
your IDE runs jvm in a non-interactive way so console is not available there.
I ended up using java.util.Scanner with System.in to get user input.
Here is some more info & options.
https://stackoverflow.com/questions/4203646/system-console-returns-null