Ask Question
11 February, 23:58

What will be the value of x[8] after the following code has been executed?

final int SUB = 12;

int[ ] x = new int[SUB];

int y = 100;

for (int i = 0; i < SUB; i++)

{

x[i] = y;

y + = 10;

}

+1
Answers (1)
  1. 12 February, 02:03
    0
    The value of x[8] is "180".

    Explanation:

    The description of the code as follows:

    In the given code we declare a variable that is "SUB" this is an integer type variable this variable uses the final keyword that is used to make variable constant and this variable holds a value that is "12". Then define an array that is "x". It is used to store integer values. and in the next line, an integer variable is defined that is "y" which holds value "100" In the loop, we increase all numbers by 10 and stores into an array. when the array size is equal to 8 it will store 180 value.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What will be the value of x[8] after the following code has been executed? final int SUB = 12; int[ ] x = new int[SUB]; int y = 100; for ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers