public class TaulEx {

  public static void main(String[] args) {
    int[] t = {9,8,7,6,5,4,3,2,1,0};

    boolean ok;
    do {
      try {
        System.out.println("Anna luku 0-9 taulokon indeksiksi");
        int i = Lue.kluku();
        System.out.println(t[i]);
                          // ^ tässä voi tulla virhe!
        ok = true;
      }
      catch (ArrayIndexOutOfBoundsException e) {
        System.out.println("Kelvoton indeksi, pitää olla 0-9");
        ok = false;
      }
    } while (!ok);
  }
} 
