Question: What will the following program print when run? Select the one correct answer. (a) 0 (b) 1 (c) 2 (d) 3 public class ParameterPass {

What will the following program print when run?

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

Select the one correct answer.

(a) 0

(b) 1

(c) 2

(d) 3

public class ParameterPass { public static void main(String[] args) { int i = 0; addTwo (i++); System.out.println(i); } } static void addTwo (int i) { 1 += 2; }

Step by Step Solution

3.44 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

b Evaluation of the actual parameter i yields 0 and increments i to 1 in ... 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!