Save ur program as "HelloWorld.java"
and save it in the directory where u have installed jdk.
like C:\jdk1.3\bin
save it in the bin folder.
Go to the Dos prompt and change ur directory to this bin folder
now type javac HelloWorld.java
C:\jdk1.3\bin>javac Helloworld.java
this will compile the program and make the byte code for this,after
successful compilation u will get a file named HelloWorld.class
now type java HelloWorld to run ur program
C:\jdk1.3\bin\java Helloworld
this should work
Assuming C:\jdk1.3 is the path where u have installed java
Better option is:
save the file in any folder u like
for eg
C:\programs\java
now here u have to specify the path of ur java compiler
set PATH=C:\jdk1.3\bin;
now
C:\programs\java>javac HelloWorld.java
then
C:\programs\java>java HelloWorld.java.
just make sure u write "public static void main (String args[])"
and not public static vooid main (String args(])