// 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();
}
}
|