programming logic and design

label Computer Science
account_circle Unassigned
schedule 1 Day
account_balance_wallet $5

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.

Apr 26th, 2015

public class ArrayBoundExceptionTest
public static void main()
num count = 0;  // count variable is used for subscript
string arr[3] = “Hello”, “Exception”, “World” // 3 string values stored in array i.e. arr


  // this loop used to  display each element of the array
  while count<=3

// 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; 



catch(ArrayIndexOutOfBoundsException aioobe)
  output “Now you've gone too far "  // display Exception Message
  output aioobe.getMessage() 




Apr 26th, 2015

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
Apr 26th, 2015
Apr 26th, 2015
Aug 22nd, 2017
Mark as Final Answer
Unmark as Final Answer
Final Answer

Secure Information

Content will be erased after question is completed.

Final Answer