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

I am confused, why on min 6:17 does he write hits = " " ;and misses =" " ; ??? i dont get it why are they blank ?

please could someone explain this step , im not understading the purpose for this step

Not sure which lesson you mean, can you post a link?

1 Answer

He's initializing the two variables to be empty strings when the game starts. Later, in the applyGuess method, he appends the player's hits and misses to those strings, but that wouldn't work unless the variables had some initial value. Even if it's just an empty string, it still has to exist before it can be appended to.

GREAT that make sense . THANK YOU :)