The Hello Application with two ifs

// This is the Hello program in Java

class Hello {

    public static void main (String args[]) {
    
      if (args.length > 0) {
        System.out.println("Hello " + args[0]);
      }
      if (args.length <= 0) {
        System.out.println(
          "Hello whoever you are");
      }
  }

}

Copyright 1996 Elliotte Rusty Harold
elharo@sunsite.unc.edu
This Chapter
Examples
Home