<<< "foreach" loop | Index | The Arrays class >>> |
Code that computes the average of the array of prices
double sum = 0.0; for (double price : prices) { sum += price; } double average = sum / prices.length;
<<< "foreach" loop | Index | The Arrays class >>> |