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 trialAdam Arafat
1,066 Points**[SOLVED]** My code doesn't work.
The code doesn't seem to work. I've typed it in, copied it from my workspace, and doesn't seem to work. I want to know why? Am I missing the opening code?
I just recently started Java coding, and I don't see how this could be wrong. Please help.
String firstname= "Amir";
2 Answers
Adam Arafat
1,066 PointsSo I resolved the issue. The question asked me for just the one line of code being
String firstname= "Amir";
Turns out the issue was the name 'firstname' the N in name needed to capitalized. Very case sensitive. Thanks for the answers though.
Jakub Łątkiewicz
5,181 PointsFirst of all, in Java everything is done using classes. You need to have a class for even simplest of operations. In this class, if you want to execute your program, you need to have a main method that takes an array of strings as an argument. So, in terms of code, it would be like
class SimpleClass{
public static void main(String[] args){
String firstname="Amir";
}
}
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsYou are correct Adam.
You code was 100% correct, except for the capitalization issue. Even though Jakub Łątkiewicz code is correct, you don't need the class for the challenge. In fact, if you put it in, the challenge will not pass.
A helpful tip: You will find as you progress through that the challenges are very picky and very strict. If you add something that wasn't asked for, or if you delete something that was pre-loaded, you get a Bummer.
Even something as simple as a missing period will often cause a Bummer! I've had times where I've spent so much time on a challenge only to realize that it was a misspelled word. Lol.
So, Welcome to Treehouse and Keep Coding! :)
Jason - Treehouse Community Moderator
I've also edited your Title to mark this post as Solved, as you figured out your error. :)