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 Creating the MVP Storing Guesses

Why hits and misses are not considered as parameters?

No matter how many times I come across explanations about parameters, it still confuses me. Why hits and misses are not considered as parameters?

2 Answers

u want to use parameters when u want to have a dynamic variable to store different results. i don’t use hits and misses as a parameter because u don’t want to initializ them every time like the answer , u want to add values to them , as far as i know

Ian Bonyun
Ian Bonyun
4,645 Points

Parameters are for user input, stuff that the method doesn't already know. The hits and misses attributes are not user input. They are part of the Game object's state and are already within its scope, which means applyGuess() can access them directly. Passing them as parameters is certainly possible, but would be redundant.