Sample Java Program


Contained in file HelloWorld.java:

//
// HelloWorld Application
//
// Uses JDK1.1 I/O classes
//

class HelloWorld {
   public static void main(String args[]) {
      System.out.println("Hello World!");
   }
}


Compiling and Executing the Program with JDK:

C:\> javac HelloWorld.java

     compiling: HelloWorld.java

[this compiles into the intermediate form (bytecodes) and places the result in HelloWorld.class]

C:\> java HelloWorld

Hello World!

[this interprets the HelloWorld.class file, which creates the output above]

C:\>


Email Me | Office Hours | My Home Page | Department Home | MCC Home Page