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 Perfecting the Prototype String Equality

I think there is an error in this challenge because I am in computer science student at UBC and this doesn't work.

Error in code on your end I belive.

Equality.java
// I have imported a java.io.Console for you, it is named console. 
String firstExample = "hello";
String secondExample = "hello";
String thirdExample = "HELLO";
if (firstExample == secondExample) {
  console.printf("first is equal to second");
}
if (firstExample.equalsIgnoreCase("thirdExample")){
  console.printf("first and thrid are the same ignoring case.");
}

3 Answers

Try this:

if (firstExample.equalsIgnoreCase( thirdExample )){
  console.printf("first and third are the same ignoring case");
}

yeah it didn't work so I changed it to == and it worked which allowed me to move to the second step which is the next if statement. my first statement is fine. its the second one thats not working.

Try (in the second statement) "thirdExample" without the quotes, should be work fine. Look my example above

thanks...I think its time for bed. LOL I should have seen that.

Yes, well. Everyone makes silly mistakes like that. Not everyone says "I'm [whatever] so I can't possibly be wrong, your code challenge is wrong." Those code challenges, especially in the basic courses, have been used by thousands of Treehouse students. It's safer to assume that you overlooked something than that the tests are wrong.

Please be a little more respectful next time you're asking others for help. A great number of people here have never set foot in a CS course in their life. And I guarantee you, a significant number of them know plenty of things you don't. We can all learn from each other, assuming we come here with an attitude of mutual respect.

Yeah your right Livia, I didn't realize that my question was made bold and I didn't mean to come off as rude! I was working on this in the wee hours of the morning and its my first time trying this platform verses others. Again I didn't mean to be rude! However, the program did not show that it was a syntex error . In fact it showed me nothing. So I made an assumption that something was wrong with the platform in reading my code. That assumption was mostly because it would normally return an error and let you know there was an error to fix. That is why I made a comment.

To give an example I had an error show up in Elipse that said "Selection does not contain a main type" I learned that my code wasn't wrong but that the file I was working on import it wrong and therefor I got an error. I have come across many plaforms that have little qlitches in it and they have a button on the bottom to report an error. I thought after looking over the code 3 times it was a platform issue in reading the code.

Next time I will be more cautious of my wording. I am sorry you took it as being rude!

Regards, Carla