86.6k views
3 votes
Looking at the code below, what value will be returned?

int[] prime = {2,3,5,7};
prime[2];


5

7

2

3

User Elenora
by
8.4k points

1 Answer

1 vote
The value that will be returned when the code is executed is 5.

Explanation: The array "prime" is initialized with four integer values - 2, 3, 5, and 7. Each of these values is assigned an index starting from 0. Therefore, the value at index 2 of the array "prime" is 5. When prime[2] is called, it returns the value at index 2 of the array which is 5.
User Col
by
8.3k points

No related questions found