import java.util.*;
class letters
{
    public static void main ()
    {
        char[] ar = new char[10]  ;
        Scanner sc = new Scanner (System.in);
        System.out.println("Enter 10 letters");
        for (int i=0; i<10;i++)
        {
          ar[i] = sc.next().charAt(0);
        }
        for (int i=1; i>=0;i++)
        {
            System.out.println("the letters in reverse are"+ar[i]);
        }
    }
}
So this is my code but when I run it and enter the letters I am getting the following error:
java.lang.ArrayIndexOutOfBoundsException: 10 at letters.main(letters.java:15)
 
     
     
     
    