Write an application named GoTooFar in which you declare an array of five integers and store five values in the array. Write a try block in which you loop to display each successive element of the array, increasing a subscript by 1 on each pass through the loop. Create a catch block that catches the eventual ArraylndexOutOfBoundsException and displays the message, "Now you've gone too far." Save the file as GoTooFar.java.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter12: Exception Handling
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
Write an application named GoTooFar in which you declare an
array of five integers and store five values in the array. Write a try
block in which you loop to display each successive element of the
array, increasing a subscript by 1 on each pass through the loop.
Create a catch block that catches the eventual
ArraylndexOutOfBoundsException and displays the message,
"Now you've gone too far." Save the file as GoTooFar.java.
Transcribed Image Text:Write an application named GoTooFar in which you declare an array of five integers and store five values in the array. Write a try block in which you loop to display each successive element of the array, increasing a subscript by 1 on each pass through the loop. Create a catch block that catches the eventual ArraylndexOutOfBoundsException and displays the message, "Now you've gone too far." Save the file as GoTooFar.java.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage