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

Why compile only Hangman file and not the Prompter?

In the hangman game after changes were made in Hangman and Prompter, only the Hangman file gets compiled. Why don't you have to compile the other files after changes were made in them too?

Is the public static void main method inside of Hangman.java? Because if so, java uses that method as an entry point into your program. Assuming that the main method is inside of Hangman.java, even if Hangman.java uses code from Prompter.java only Hangman.java needs to be compiled.

1 Answer

it's because the main method is in hangman and prompter is used by it, so when you compile hangman you also compile everything that gets used by hangman at the same time. so you don't need to compile them separately

hope this helps