e5riSaGiam4orogerl e5riSaGiam4orogerl
  • 08-01-2017
  • Computers and Technology
contestada

Suppose the following array is declared:

int[ ] grades = {88, 92, 95, 83};

What is the value of grades[grades.length-1]?

An ArrayIndexOutOfBoundsException occurs
88
92
82
83

Respuesta :

kaevras
kaevras kaevras
  • 08-01-2017
83.

grades.length will return the number of elements in the array, starting from 1, unlike when you actually use the array, where the index starts from 0.

This means grades.length will return 4, as there are 4 elements in the array. We are subtracting 1 from this number, meaning we are finding the value of grades[3], which would equal 83, as an array index starts from 0, where

88 = grades[0]
92 = grades[1]
82 = grades[2]
and 83 = grades[3]

Answer Link

Otras preguntas

divide 100 in the ratio 2:3.​
What is Mussolini trying to accomplish in this part of his speech? He’s trying to warn the enemies of Italy. He’s trying to justify the invasion of Ethiopia. He
What is ergonomic in computer and technology
Please Help Meeeee!!! Will Mark Brainliest!!!
what does "fade from thee as a flower in May" mean​
1) 3x + 6 - 2 + 5x 2) a bicycle is originally priced at 80$. The store owner gives a discount and the bicycle is now 60$. What percent discount was taken off?
divide 100 in the ratio 2:3.​
NEED AN ANSWER NOW! WILL GIVE YOU BRAINLIEST!! I can't figure out what's the answer, I'm clueless.
How was American trade established with Japan? from promises of industrial development on the island after a rebellion against foreigner through military force
Why might the author use the word pouring to describe the snake action in paragraph 91?