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
David Espitia
2,251 PointsMy code keeps giving out the answer.
I am following the video on the java object course. And when it comes to running the game. My code keeps displaying the answer instead of displaying dashes to hide the answer.
Here is the link to my work space. https://w.trhou.se/sz0cp3rous
1 Answer
andren
28,558 PointsIn your if statement inside the getCurrentProgress method in the Game class:
if (hits.indexOf(letter) == -1){
display = letter;
}
You use == when I'm pretty sure you meant to use !=. If you fix that typo then I think your code will work.
David Espitia
2,251 PointsDavid Espitia
2,251 PointsThank you for your help. That part of my mistake, I re-watched the video and saw where my display error was thank you.