Learning Java: Monty Hall Simulation

I’ve always found the Monty Hall problem kind of interesting. So I wrote a little Java program to demonstrate it. Here’s an example of the output:

C:\Home\working\java\MontyHall>java -jar MontyHallTest.jar 10000
Sticking with the same box wins 3368 out of 10000, or 33.68%
Switching boxes wins 6682 out of 10000, or 66.82%

Downloads:
montyhall.zip – source files.
montyhalltest.jar – java archive.


Leave a Reply