Hello world ! classic

This is the classic hello world tutorial for java, to get the java compiler and also the run-time environment you will need to goto the Java (Sun). The compiler (javac) compiles into java byte code, which means that this code is able to run on any OS with the java run-time environment (aka virtual machine).

If you save this

public class helloworld
	public static void main(String[] args)
		System.out.println("Hello world");

as helloworld.java

and then from the command line

javac helloworld.java

this will create the helloworld.class which is the java byte code, to run the byte code.

java helloworld

and hopefully there will be

Hello world

on the console.

Leave a Reply

Your email address will not be published. Required fields are marked *