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 trialChloe Leow
786 PointsNot sure what is wrong with String Equality Challenge Task 1
I got a lot of errors. How am I supposed to fix this?
// I have imported a java.io.Console for you, it is named console.
String firstExample = "hello";
String secondExample = "hello";
String thirdExample = "HELLO";
if (firstExample.equals ("secondExample")) {
console.printf("first is equal to second. \n");
System.exit(0);
2 Answers
Brody Ricketts
15,612 PointsRemove
System.exit(0);
That is not needed for this challenge. Take a look at your braces ({}), are you missing any?
When completing any Treehouse challenge, ensure that you follow the directions precisely as they are written. The instructions didn't ask for a new line to be created.
Remove
"\n"
Bertan Ulusoy
18,047 PointsHi, your string equality check must not have quotation mark.
if (firstExample.equals(secondExample)) { ....
Chloe Leow
786 PointsYeah, I did search on Google for that, but there are still lots of errors despite changing that.
Chloe Leow
786 PointsChloe Leow
786 PointsThanks! It helped.