FileDocCategorySizeDatePackage
StringCounter.javaAPI DocExample452Mon Mar 02 21:02:02 GMT 1998None

StringCounter.java

// File:  StringCounter.java
// T Balls
// March 1998
// Output a string 5 times


public class StringCounter
{  public StringCounter( String s )
   {  str = s;
   }

   private String str;
   
   public void run()
   {  for( int i = 1; i <= 5; i++ )
      {  System.out.println( "" + i + "\t" + str );
      }
   }

   public static void main( String[] args )
   {  new StringCounter( "Fred" ).run();
      new StringCounter( "Alice" ).run();
   }
}