Check out Ideone.com. You can type in a Java program and it'll compile it and then run it for you and display the output. Here's a hello world example I just typed in.
Code:
public class Main {
public void main(String[] arguments) {
System.out.println("Hello world!");
}
}
Output:
result: success time: 0.1s memory: 213376 kB returned value: 1
input: no
output: no
stderr:
Exception in thread "main" java.lang.NoSuchMethodError: main
Oops, I forgot to declare main as static!