Extending 11.4.6's parameter passing and return values to work with arrays and arrays of objects.
Passing an entire array (or an array of objects) as a method parameter, allowing a method to process a whole collection of data at once rather than one item at a time.
Example
public double calculateAverage(int[] marks) { int total = 0; for (int mark : marks) { total += mark; } return (double) total / marks.length; }
Typed methods can also return an entire array or an array of objects — useful for methods that filter, transform, or build a new collection from existing data.
Example
public Learner[] getTopPerformers(Learner[] allLearners, double threshold) { // ... logic to filter and return only qualifying Learner objects as a new array }
💡 Exam Tip
Passing arrays by reference (as in Java) means a method can directly modify the original array's contents — be intentional about whether a method should modify the original data or return a new, separate array.