You could also put that code into the main() method
Have a look at the
Java tutorials on the official website, they should help you out :
http://download.oracle.com/javase/tutorial/
Also, might be a good idea to update your profile to include your "firstname lastname", before the mods pounce ;)