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

Adam Arafat
Adam 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.

Name.java
  String firstname= "Amir";  

2 Answers

Adam Arafat
Adam Arafat
1,066 Points

So 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.

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

You 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 :dizzy:

I've also edited your Title to mark this post as Solved, as you figured out your error. :)

Jakub Łątkiewicz
Jakub Łątkiewicz
5,181 Points

First 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";
  }
}