design an application in which you declare an array of three strings and store three values in the array. write a try block in which you loop to display each successive element of the array, increasing a subscript by one on each pass through the loop. assume that an arrayindexoutofboundsexception is created automatically when a subscript is not correct for an array. create a catch block that catches any exception and displays the message now you've gone too far.
public class ArrayBoundExceptionTest
public static void main()
num count = 0; // count variable is
used for subscript
string arr = “Hello”, “Exception”, “World” // 3 string values stored in array
// this loop used
to display each element of the array
// display the value of each element of array
output "The value of element
of array is ", arr[count]
// increment in subscript by 1
count = count + 1;
output “Now you've gone too far " // display Exception Message
Apr 26th, 2015
Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.