What would be the result after the following code is executed?
final int SIZE = 25;
int[] array1 = new int[SIZE];
// Code that will put values in array1
int value = 1;
for (int a = 0; a < array1.length; a++)
{
array1[a] = value;
value = value + array1[a];
}
// TestCode.java import java.util.Arrays; public class TestCode { public static void main(String[] args) { final int SIZE = 25; int[] array1 = new int[SIZE]; // Code that will put values in array1 int value = 1; for (int a = 0; a < array1.length; a++) { array1[a] = value; value = value + array1[a]; } System.out.println(Arrays.toString(array1)); System.out.println(value); } }
array1 is [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216] value is 33554432
Get Answers For Free
Most questions answered within 1 hours.