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 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.