// This is an example of arrays.  A loop reads Strings from the console
// and stores them in an array; another loop prints the array entries.
import java.util.Scanner;

public class PageReader {
	private static final int SIZE = 10;
	private String[] A;
	private int used;
	
	public PageReader() {
		A = new String[SIZE];
		used = 0;
	}
	
	public void ReadStrings() {
		// On Windows you can terminate the input with <CTRL-Z>
		// On linux I think it needs <CTRL-D>
		Scanner console = new Scanner(System.in);
		int i = 0;
		System.out.print( ">>> ");
		while (i < A.length && console.hasNextLine()) {
			A[i] = console.nextLine();
			i += 1;
			System.out.print( ">>> ");
		}
		used = i;
	}
	
	public void PrintStrings() {
		System.out.println();
		for (int i = 0; i < used; i++)
			System.out.printf("%2d. %s\n", i, A[i]);
	}
	
	public static void main(String[] args) {
		PageReader reader = new PageReader();
		reader.ReadStrings();
		reader.PrintStrings();
	}

}
