1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
trapecia [35]
3 years ago
5

Java

Computers and Technology
1 answer:
Triss [41]3 years ago
7 0

The program illustrates the use of catching exceptions using try and catch.

  • Exceptions are simply errors that can crash a program
  • Try and catch are used to prevent errors from crashing a program

The required try and catch block is as follows:

<em>try { </em>

<em>        System.out.print(names[index]); </em>

<em>    } </em>

<em>    catch (ArrayIndexOutOfBoundsException e) { </em>

<em>   System.out.println(e.getMessage()); </em>

<em>}</em>

The flow of the above code segment is as follows:

First, we begin with the try block

<em>try {</em>

Then the program prints the element at the index

<em>        System.out.print(names[index]);     }</em>

If the index does not exist in the array (e.g. -1 or 11), then the catch block is executed

<em>    catch (ArrayIndexOutOfBoundsException e) {</em>

This prints the appropriate exception

<em>   System.out.println(e.getMessage()); }</em>

See attachment for sample run

Read more about similar programs at:

brainly.com/question/21330187

You might be interested in
Can someone help me with these questions on linear dimensions pls
andrew-mc [135]
Size dimentions reffer to overall dimentions and will tell the overall width, lenth height and depth of something location dimentions means the locatuon of each geometric shape.
7 0
3 years ago
Read 2 more answers
Select the correct answer.
storchak [24]

Answer:

B. Planning

Explanation:

I believe the developer establishes the project goals in the planning phase.

6 0
4 years ago
A_ is an object makerfirst program second object third class fourth method ​
liberstina [14]

Answer:

you will use the components object animator whether sjetchware or HTML

5 0
3 years ago
A computer processor can become extremely hot and must be cooled. A heat sink is placed on top of the processor to extract its h
Schach [20]
Hello,

The Answer would be Metal
5 0
3 years ago
The IMA standard that includes disclosing all relevant information that could reasonably be expected to influence an intended use
Damm [24]

Answer:

Credibility.

Explanation:

The IMA or institute of management and accounting is one of the largest and most respected group or association of accountants and other financial professionals in the business industry, with the collaborative intent to advance and promote the management and accounting profession.

All members of the association obligatorily adhere to four principles. They are, honesty, fairness, objectivity and responsibility. And they also follow four IMA standards, which are credibility, competence, integrity and confidentiality.

The credibility standard includes disclosing all relevant information that could reasonably be expected to influence an intended user's understanding of the reports, analyses or recommendation.

4 0
4 years ago
Other questions:
  • Match the technology with the appropriate task.
    7·1 answer
  • (a) Explain the difference between a web browser and a search engine.​
    15·1 answer
  • _____ computing refers to a computing environment that is always present, can feel our surroundings, and-based on who we are, wh
    8·1 answer
  • What do you use for soaking hands and holding soapy water​
    7·2 answers
  • Advantages of bursaries??????
    11·1 answer
  • A laptop has an Nvme drive (C:) and a mechanical hard drive (D:), when the user notice that the D: drive is not there.
    10·1 answer
  • X= [12,67,89,34,56,90,67]
    6·1 answer
  • A large computer software firm promised a client that it could deliver a new operating system on a tight deadline and put Keith
    10·2 answers
  • 1. The letters that appear after the dot after a file name are called the:
    15·1 answer
  • What is used for risk response control?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!