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 Current Progress

Wan Nor Adzahari Wan Tajuddin
Wan Nor Adzahari Wan Tajuddin
2,438 Points

Why prompter.displayProgress() is being repeated twice?

In Craig's Hangman.java, the code prompter.displayProgress()is being repeated twice. The first is at line 7 and the second is at line 14.

On my code here, it is being repeated on line 7 and 15. https://w.trhou.se/1wxxzjb9at

Pranjal Agnihotri
Pranjal Agnihotri
4,187 Points

Hey Mate, According to the Link you shared of your code: When we we will call getProgress() for first time(On 7th line) then it will print spaces equivalent to the length of the Correct Answer which is stored. Hope It Helps!..

1 Answer

andren
andren
28,558 Points

Because he wants the progress to be printed twice. Once before a guess is made so you can see how many letters there are to solve, and once after the guess is made so you can see how many letters you found.