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 Java Objects (Retired) Delivering the MVP Validation

Jian Chen
Jian Chen
4,938 Points

Why set something to false as default in a boolean method and return it when it was not used for anything else?

In 9:53 of the "Validation" video, Craig return isHit; and it was set to false as default within that boolean method. But the method does utilize the isHit variable in any way other then returning it in the end. Then what is the whole point? Am i missing something? Please help me clarify this, I would really appreciate any help.

1 Answer

Hi Jian,

At about 8:38 in the video, Craig sets isHit equal to the return value of mGame.applyGuess(guess).

Hope this helps,

Cheers

Jian Chen
Jian Chen
4,938 Points

Oh yeah! I was too careless for missing that. Thanks Robert.