1. Why does Producer keep puting even though I set the shared variable maxHit to true if the number is > 2, and no assignment is made? (Line 59)
The producer only adds once more than you expect. Think of the sequence which occurs:
So your condition for stopping is wrong if you want it to stop before it reaches 3.
2. Why are there 2 consecutive "Consummer Got: 3" at the end?
When the Consumer is done with getting the 3, the consumer thread maintains possession of the synchronizing lock long enough to get into wait() statement, before the producer has a chance to switch the maxHits flag to true. So the Consumer goes into wait() and the Producer has a chance to get hold of the synchronizing lock, switches maxHits to true, notifies the Consumer it is done, then ends.
The Consumer has a chance to get the synchronized lock again, and since Producer didn't increment sharedNumber it sees the value of 3 and reports it. The Consumer now sees the maxHits is true and the Consumer ends.
The sequence that occurs here is: