Time remaining:
programming logic and design

label Computer Science
account_circle Unassigned
schedule 0 Hours
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 24th, 2015

  We can place strings of text into arrays in java in the same way as for integers.

The initialization is done as follows:

String[] Stringnew=new String[2];



We create java code in which an array of three strings is initialized and encksed in a try catch block which can handle array out of bounds exception if one arises.

 class Arrayofstrings {

    public static void main(String args[]) {

     try {

// let's make our own array of strings

int num_states=3;

int i;

    String[] states = new String[]

         { "California", "Ohio",



    for(i = 0; i < num_states; i++)




    }//try block ends


catch (ArrayIndexOutOfBoundsException e) {

    System.out.println("Error:Array Out of Bound;;;You have gone too far");









Apr 24th, 2015

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

Secure Information

Content will be erased after question is completed.

Final Answer