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 trialMUZ140118 Cathrine Makuya
10,300 Pointsstage 3 challenge 1
Add an If statement that checks to see if the firstExample is equal to secondExample. If it is ,print out "first is equal to second'.
if (firstExample.equals("secondExample"))
console.printf("first is equal to second");
2 Answers
Gloria Dwomoh
13,116 PointsAgain, almost correct. You don't need quotation marks on secondExample...as it is a variable. Removing the quotation marks gives you this.
if (firstExample.equals(secondExample))
console.printf("first is equal to second");
Craig Dennis
Treehouse TeacherAlso, looks like you are forgetting the opening curly brace {
and the closing one }
. Java will work without them, but only the first line. Not using braces is considered bad practice, and will cause you problems if you add another line.
MUZ140118 Cathrine Makuya
10,300 PointsMUZ140118 Cathrine Makuya
10,300 Pointsok ok thank you very much