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 trialRemington Evert
2,654 PointsDon't Understand First Part of Challenge
I don't understand how to write the equals portion to actually compare the firstExample and secondExample.
I originally got past the first part of the challenge with if (firstExample.equals("hello")); but I don't see how that piece of code actually compares both values.
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Remington,
Instead of passing in the string "hello" you can pass in the variable secondExample
if (firstExample.equals(secondExample))
This will check if the 2 variables are equal,
The code you posted is checking if firstExample
is equal to the string "hello" without taking into consideration the second variable.
Dylan Merritt
15,682 PointsCan you please post the exact question from the challenge you are referring to?