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 trialCarolina Estrada
1,285 PointsI dont get it the beginning of the video he puts firstName.equals("Bob"); and getsa new variable $3 which = false, how?
I don't understand how he got a a whole different variable $3 which equals to false, Am I missing something? I don't get it. I tried this in jGRASP as well but that doesn't come out. I also don't understand how he gets the new variables after that.
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHi Carolina,
The variable $3 that he get back is not really relevant. This variable only shows up because Craig is using the Java REPL to show the examples. The REPL always returns the value of an executed line of code into a new variable that it creates. Craig touches on this feature in REPL at ~3:05 - ~3:45.
As for the False
value. This is because he is comparing the name "Bob" to the variable that is storing "Craig." These don't match, so False
is returned.
Hope that clears it up for you. :)
Tim Barbarino
5,449 PointsI got this from googling about it - When an expression is entered that doesn't have a named variable, a scratch variable is created so that the value can be referenced later.
Carolina Estrada
1,285 PointsCarolina Estrada
1,285 PointsAlright thanks!