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 trialPhuc Nguyen
367 PointsThe compiler said I got an error on line 4 and I have no idea how to fix
The compiler said I got an error on line 4 and I have no idea how to fix
// I have setup a java.io.Console object for you named console
public class Name {
public static void main(String[] args) {
String firstName = "Phuc";
console.printf("Hello, my name is %s\n", firstName);
console.printf("%s is learning how to write in Java\n", firstName);
}
}
2 Answers
Fahad Mutair
10,359 Pointsin 1st line he said
// I have setup a java.io.Console object for you named console
since you don't have syntax error in your code, and as he said you don't have to declare class name and main method just remove those
public class Name {
public static void main(String[] args) {
Emilio Sebastian
643 Pointserase everything and just let ------------------------------->
String firstName = "Phuc";
console.printf("Hello, my name is %s\n", firstName);
console.printf("%s is learning how to write in Java\n", firstName);
Phuc Nguyen
367 Pointsthank you, I appreciate
Phuc Nguyen
367 PointsPhuc Nguyen
367 Pointsthank you it worked eventually