Guess how many are in the jar game in Java
Javadoc, Javadoc, Javadoc



import java.io.*;


Wildcard imports are sub-optimal. You never know what exactly is imported and it might conflict with other imports.



Classes should all be declared in their own files, this smells like you have all in one file.



class Test {


The main class should ideally be public. I also prefer to have Main somewhere in the name (or as name).



class Game {
    ....
    private Prompter prompter;


It is declared but never used.



You always create a new instance of Prompter but it only contains static methods. So either you make it a static helper class (and always invoke the methods statically) or you make it an instance class. I'd opt for an instance class.



String line;

do {
    System.out.print("Ready? (press ENTER to start guessing): ");
} while ((line = scanner.nextLine( )).length( ) &gt; 0);


Why you need a line variable at all here?



Your logic is split over all the classes, each class has a little piece of the puzzle and the flow is just as far stretched. It is very hard to follow the actual program flow because you have to piece it together from all over the place.

Ideally, you'd have the main class, a class containing the actual logic and some helper classes. The main class would kick off your logic class, which would contain some setup code and the actual logic for the game logic.

Consider this pseudo-code:

class Main
    static void main()
        new Game().start()

class Game
    void start()
        setupPlayers()
        setupJar()

        do
            echo "Guess! "
        while getAnswer() != jarCount


Something like this. Abstract the details away behind methods but keep the main logic in one place, so that it is easy to follow the program flow.


  Your main method should tell me what your application does, not how it does it.


On a related note, Your classes are encapsulating state that does not need to be in its own class. Jar is only used once, there speaks nothing against having these four variables in your Game class. Same for the Player class, which only contains a method which would be better in the Game class.

You have filleted the code into too many classes, all this could be done in one well organized class.



I have to say, with a few exceptions, your naming is always spot on and awesome! Good job.