package lectures.exceptions;
import util.annotations.WebDocuments;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

@WebDocuments({"Lectures/Exceptions.pptx", "Lectures/Exceptions.pdf", "Videos/Exceptions.avi"})
public class LinesReaderAndPrinterMainPropagatingExceptions {

    public static void main(String args[]) throws IOException, ArrayIndexOutOfBoundsException {     
            echoLines(numberOfInputLines(args));        
    }

    static BufferedReader inputStream = new BufferedReader(
            new InputStreamReader(System.in));
//  static void echoLines(int numberOfInputLines)  {
    static void echoLines(int numberOfInputLines) throws IOException {
        for (int inputNum = 0; inputNum < numberOfInputLines; inputNum++)
            System.out.println(inputStream.readLine());
    }
//  static int numberOfInputLines(String[] args){
    static int numberOfInputLines(String[] args)
            throws ArrayIndexOutOfBoundsException {
        return Integer.parseInt(args[0]);
    }

}