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 trialrey enmanuel guerrero martinez
629 Pointsit doesn't want to work, why?
well, first i write the code .....console.printf Console.printf("Hello, my name is Rey"); then i go to the console and write the javac Introductions.java for compile it but when i click enter it makes error.....
Introductions.java:8: error: non-static method printf(String,Ob
ject...) cannot be referenced from a static context
Console.printf("Hello, my name is Rey");
This is the error, and i don;t know why because i wrote this like in the video
3 Answers
Jon Kussmann
Courses Plus Student 7,254 PointsConsole should not be capitalized.. 'console';
ISAIAH S
1,409 PointsTry this:
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("Hello, my name is Rey");
}
}
rey enmanuel guerrero martinez
629 PointsDude, thanks a lot but it didn't work it still show the error....
seanmckenzie2
3,946 PointsIf you copy and paste this into your workspace it should work
ISAIAH S
1,409 PointsWhat about copying/pasting my code, then press Ctrl + S
, which will save the workspace.
rey enmanuel guerrero martinez
629 PointsThanks Man!!
ISAIAH S
1,409 PointsPlease mark this answer best answer, so that others will know that it is solved.
rey enmanuel guerrero martinez
629 Pointsrey enmanuel guerrero martinez
629 Pointsbut however i do it, it still shows the error