Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.