29 January 2012

Hello, World! - Final


Ultimate version of the classic Hello, World! bootstrap main program:

public class HelloWorldFinal {
   public static void main(String[] args) {
      String to = "World";
      if(args.length > 0) {
         to = args[0];
      }
      System.out.println(String.format("Hello, %s!", to));
   }
}

Hello, World! - Revisited

Second post - Still Trial

public class SecondSample {
   public static void main(String[] args) {
      System.out.println("Hello, " + args[0] + "!");
   }
}

Hello, World!

First sample - Hello, World!

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