package _01_对象数组;

public class PhoneTest {
    public static void main(String[] args) {
        Phone[] phones = new Phone[3];
        phones[0] = new Phone("小米",1000,"红色");
        phones[1] = new Phone("华为",2000,"红色");
        phones[2] = new Phone("苹果",3000,"红色");

        double sum = 0;
        for (Phone phone : phones) {
            sum += phone.getPrice();
        }
        System.out.println("总和为:"+ sum);
        System.out.println("平均值为:" +(sum / phones.length));
    }
}
