holy crap, are you that much of a beginner? when writing a java file save it as a .java. Then, make a batch file (.bat or .cmd) in the same folder with the following code:
@echo off
javac *.java
pause
Running that file will tell the JVM ( Java Virtual Machine ) to copile it into a .class file.
To run your java program, which is the .class program, make another batch file with this code:
@echo off
java *.java
There, that's pretty much it on compiling and running basic java programs. Applets are a bit harder and you should learn more first.
Edit: Sorry btw, just saw the age of this post.