package com.example.domain;

public class ExceptionHandling {

	public static void main(String[] args) {
		int[] numbers = { 1, 2, 3 };

		try {
			System.out.println(numbers[0]);
			System.out.println(numbers[2]);	// error

			System.out.println("before loop...");
			
			for (int i = 0; i < numbers.length; i++) {
				System.out.println(numbers[i]); // error
			}
			System.out.println("after loop...");
			
		} catch (ArrayIndexOutOfBoundsException ex) {
			System.out.println(ex.getMessage());
		} finally {
			System.out.println("This will always executed");
		}
	}

}
