Ask Question
27 October, 21:51

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;

}

+2
Answers (1)
  1. 28 October, 00:14
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers