1. Write a program that creates an array with 100 randomly chosen integers. Your program should prompt the user to enter an index of the array, then displays the corresponding element value. It should prompt he user to enter the index again if the specified index is out of bounds and display the message "Index is out of bounds". You must use Exceptions to handle "index is out of bounds" error. Hint: Use ArraylndexOutOfBoundsException 2. What are the advantages of using exception handling?

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter12: Exception Handling
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question
1. Write a program that creates an array with 100 randomly chosen integers. Your program should prompt the user to enter an
index of the array, then displays the corresponding element value. It should prompt he user to enter the index again if the
specified index is out of bounds and display the message "Index is out of bounds". You must use Exceptions to handle "index is
out of bounds" error. Hint: Use ArraylndexOutOfBoundsException
2. What are the advantages of using exception handling?
Attach File
Browse Local Files
Transcribed Image Text:1. Write a program that creates an array with 100 randomly chosen integers. Your program should prompt the user to enter an index of the array, then displays the corresponding element value. It should prompt he user to enter the index again if the specified index is out of bounds and display the message "Index is out of bounds". You must use Exceptions to handle "index is out of bounds" error. Hint: Use ArraylndexOutOfBoundsException 2. What are the advantages of using exception handling? Attach File Browse Local Files
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Exception Handling Keywords
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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