Artem H.

asked • 05/07/21

Is it True That; Here is a program that tries to change the value of one the element of an array by passing the array to a changeNames method:

Here is a program that tries to change the value of one the element of an array by passing the array to a changeNames method:


Is This True?


The output of this program is

[Alison, Biance, Cody, Derek]

class Main {

public static void main(String[] args) {

String [] names = {"Amy", "Biance", "Cody", "Derek"};

String [] change= changeNames(names);

System.out.println(Arrays.toString(change));

}

public static String [] changeNames(String [] names){

String [] change = names;

names[0]= "Alison";

return change;

}


}


1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.