The do while loop in Java

// This is the Hello program in Java
 
 class Hello {
 
   public static void main (String args[]) {
 
     int i = -1;
     do {
       if (i == -1) System.out.print("Hello "); 
       else {
         System.out.print(args[i]);  
         System.out.print(" ");
       }
       i = i + 1;
     } while (i < args.length);
     System.out.println();  // Finish the line
  }
 
}

Previous | Next | Top | Cafe au Lait

Copyright 1997 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified August 1, 1997