<<< Arrays.sort | Index | Declaring array as formal parameter to a method >>> |
Code that creates a reference to an array
double[] grades = {92.3, 88.0, 95.2, 90.5}; double[] percentages = grades; percentages[1] = 70.2; // changes grades[1] too System.out.println("grades[1]=" + grades[1]); // prints 70.2
Code that reuses an array variable
double[] grades = new double[5]; grades = new double[20]
<<< Arrays.sort | Index | Declaring array as formal parameter to a method >>> |