FileDocCategorySizeDatePackage
ForInDemo.javaAPI DocExample715Wed Apr 20 14:43:34 BST 2005None

ForInDemo

public class ForInDemo extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

         // This is a collection we'll iterate over below.
         Set<String> wordset = new HashSet<String>();

         // We start with a basic loop over the elements of an array.
         // The body of the loop is executed once for each element of args[].
         // Each time through one element is assigned to the variable word.
         for(String word : args) {
             System.out.print(word + " ");
             wordset.add(word);
         }
         System.out.println();

         // Now iterate through the elements of the Set.
         for(String word : wordset) System.out.print(word + " ");