• Array index out of bound exception

    Write a program that first creates an integer array a[50], and set a[i] = i+3, i=0 to 49. The program next reads in an index k from the user, then calls a method readValue(int [ ] a, int k) that would return the value of a[k]. The main program displays the value a[k]. If the index is out of bounds, the method readValue(int [ ] a, int k) should throw an IndexOutOfBoundsException. The main program should catch the exception and display the message "out of bounds".

    0
    334
    423B
    2014-06-03
    25
关注 私信
上传资源赚积分or赚钱