Here is an online Java IDE -- an editor that also lets you run code right in the browser. At the top is the editor, below that is a Run button, and then below that the output. You can edit the code in the editor and run it as many times as you want. This does unfortunately have ads, some of which might be misleading; you do not need to download any extra tools to use this page, just save your file. You may also use any other java IDE you prefer, this is the most convenient one I found.

About the Java IDE:

Using the IDE