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 trialchannonhall
12,247 Pointserror error
is there a problem with the 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
String firstName = console.readLine("What is your name? ");
console.printf("Hello, my name is %s\n", firstName);
console.printf("%s is learning how to write java\n", Firstname);
because when i do this in the console javac Introductions.java it says this:
Introductions.java:10: error: cannot find symbo l console.printf("%s is learning how to wri te java\n", Firstname);
^
symbol: variable Firstname location: class Introductions 1 error
could anyone help
2 Answers
Marcus Parsons
15,719 PointsHey Channon,
In your first, console.printf()
command "firstName" is referenced correctly, but in the second one, it is "Firstname" when it should be "firstName". It looks as though this is your error.
I hope that helps!
Ken Alger
Treehouse TeacherChannon;
Welcome to Treehouse!
As Marcus Parsons points out, you need to make sure to utilize the same capitalization scheme for your variables throughout your code. Java is case sensitive and will interpret Firstname
as an entirely different variable from firstName
.
Happy coding,
Ken
channonhall
12,247 Pointschannonhall
12,247 Pointsthank you so much
Marcus Parsons
15,719 PointsMarcus Parsons
15,719 PointsNo problem! :)