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 trial

Java Java Basics Getting Started with Java Strings, Variables, and Formatting

struck here need help string firstName="Naaz"; console.printf("%s",firstName);

Help

Name.java
string firstName="Naaz";
console.printf("%s",firstName);

2 Answers

A Y
A Y
1,761 Points

Manoj,

You have a very small bug in your code: string firstName="Naaz"; console.printf("%s",firstName); (((You have declared the firstName as string instead of String and Java is a case sensitive language means the letters upper case and/or lower case matter and considered errors))) Please try: (((String firstName = "Naaz"; console.printf("%s",firstName);))) and it will work.

Regards, Amir

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey there,

If you're on Task 1, then you shouldn't have that second line... the instructions did not ask for that. However, you have a syntax error in line 1. String type needs to have an upper-case "S" (other than that the syntax is correct :thumbsup:)

If you're on Task 2, then I'm not sure what you changed String to string, but the second line is not producing the string that the instructions are asking for. Instructions are very strict and need to be followed exactly, so you just need to output the exact string the instructions are asking for.

Keep Coding! :) :dizzy: