Question: What will be the result of compiling and running the following program? Select the one correct answer. (a) 13 (b) 14 (c) 20 (d) 21

What will be the result of compiling and running the following program?

public class EvaluationOrder { public static void main(String [] args) { int[]

Select the one correct answer.

(a) 13

(b) 14

(c) 20

(d) 21

(e) 24

public class EvaluationOrder { public static void main(String [] args) { int[] array = {4, 8, 16 }; int i = 1; array[++i] = -1; System.out.println (array [0] + array[1] + array[2]); } }

Step by Step Solution

3.44 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a First the expression i is evaluated resulting in the value 2 Now the variable i also has t... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming 8th Questions!