Time remaining:
programming logic and design

Computer Science
Tutor: None Selected Time limit: 0 Hours

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

Did you know? You can earn $20 for every friend you invite to Studypool!
Click here to
Refer a Friend
Apr 24th, 2015
Apr 24th, 2015
Feb 27th, 2017
Mark as Final Answer
Unmark as Final Answer
Final Answer

Secure Information

Content will be erased after question is completed.

Final Answer