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 trialAndrew Minert
3,984 Pointsprintf not working. Everything looks good until I try and run the code.
I have this in my code
import java.io.Console;
public class Introductions {
public static void main(String[] args) {
Console console = System.console();
// Welcome to the Introductions program! Your code goes below here
console.printf("My name is Andrew");
}
}
and then I type this in my console
treehouse:~/workspace$ javac Introductions.java
Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
treehouse:~/workspace$ ls
Introductions.class Introductions.java
treehouse:~/workspace$ java Introductions
Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
treehouse:~/workspace$
Why is it not printing My name is Andrew into the console?
3 Answers
Denis Madroane
2,983 PointsDid you hit Save before you compiled? I remember this happening to me when I first went through that course. Go to File>Save All and then try to compile again.
Mykhaylo Stolyarchuk
Courses Plus Student 94 PointsBefore compiling you have to make sure that the code is saved. Then you need to compile with javac, afterwards with java you can compile console.printf
Ehab Mohammad
Courses Plus Student 43 PointsI'm having that issue myself right now, but I've tried both of these answers and neither has helped me
spencer bengoetxea
1,132 PointsDid you make sure that console.printf is all lowercase?
Andrew Minert
3,984 PointsAndrew Minert
3,984 PointsThank you! That was exactly what I did wrong