Java wait and notifyAll: IllegalMonitorStateException
问题 I am Java newbie (and RoR developer). I have a simple program. Ball is shared amont players. Ball should be passed to random Player. Ok here goes the code: class Ball { private int currentPlayer; public void setCurrentPlayer( int currentPlayer, int fromWho ) { this.currentPlayer = currentPlayer; System.out.println( "Ball:setCurrentPlayer " + fromWho + " ---> " + currentPlayer ); } public int getCurrentPlayer() { return currentPlayer; } } class Player implements Runnable { private int myID;