0

I'm new to Java. This code runs properly in Treehouse's workspace, but fails in my IDE, Eclipse. I don't see what the error is. I'm clearly adding a string to the printf function, but its evaluating as null?

enter image description here

  • Do you know what version of java each environment is running? – dckuehn Aug 25 '16 at 18:50
  • JavaSE-1.8 , just downloaded it the other day. Running on Windows 32 bit –  Aug 25 '16 at 18:51
  • From the [javadoc](https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#console()), System.console() returns `null` if the System doesn't have a console. Your `String` is fine, by the way (and in fact, wouldn't throw an NPE even if it were null. You can pass null as a reference, it's only when you try to look inside that reference that things break, and `printf` has null checking, so this would just print "Hello, my name is null!") – Edward Peters Aug 25 '16 at 18:54
  • So why doesnt the system have a console? Did i setup the wrong type of project? –  Aug 25 '16 at 18:55

0 Answers0