Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

int[] data = {9, 3, 5, 0}; method(data); public static int[] method(int[] source

ID: 3683282 • Letter: I

Question

int[] data = {9, 3, 5, 0};

method(data);

public static int[] method(int[] source)

{

                  source = new int[3];

                  source[0] = 7;

                  source[1] = 5;

                  source[2] = 3;

                  return source;

}                                                                                                                                                                                                     Heap

Identifier

Address

Contents

1000

1001

1002

1003

1004

1005

1006

1007

1008

1009

1010

1011

1012

Main Stack Frame            

Identifier

Address

Contents

101

102

103

Method Stack Frame

Identifier

Address

Contents

200

201

202

After this code is executed, the array data contains:

Identifier

Address

Contents

1000

1001

1002

1003

1004

1005

1006

1007

1008

1009

1010

1011

1012

Explanation / Answer

After this method is executed then array data may contain data = {9, 3, 5, 0} same contents because it is call by value and not by reference.