• 博客(0)
  • 资源 (1)

空空如也

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".

2014-06-03

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除