java接受傳入陣列 double calculateAllPrices(Land… Lands) { //or Land[ ] Lands double total = 0; // 加總變數 for(Land l : Lands) { // 一一取出各個物件 total += calculatePrice(l); // 個別計算並累加 } return total; } // ================================================