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

Java

The code from the Java basics does not work in Netbeans IDE.

The console commands e.g. console.printf() and System.console() do not have red lines under the code but when I try to run it, an error comes up saying that the .printf method has a null value. Since it doesn't work I'm using the System.out.println() method instead, but I was wondering why the code doesn't work. I've copied it exactly as it is in the video but it doesn't work.

1 Answer

A quick google search told me that

Bug 111337 – java.io.Console not supported - NetBeans https://netbeans.org/bugzilla/show_bug.cgi?id=111337 תרגם דף זה 1 2007 - In both NetBeans 5.5.1 and 6.0 M10, java.io.Console is not supported. However ... from both JDK 1.7.0b16 and JDK 1.6.0_02b5: import java.io. Bug 235334 – cannot run the console from within Netbeans https://netbeans.org/bugzilla/show_bug.cgi?id=235334 תרגם דף זה 17 2013 - Console; import java.io. ... SocketException; import java.util.logging. .

But the high level answer is that you need to import the console first before using it.