package _01_对象数组;

public class GirlFriendTest {

    public static void main(String[] args) {
        GirlFriend[] girlFriends = new GirlFriend[4];
        girlFriends[0] = new GirlFriend("小丽",18,"女","逛街");
        girlFriends[1] = new GirlFriend("小红",28,"女","吃饭");
        girlFriends[2] = new GirlFriend("小美",38,"女","打麻将");
        girlFriends[3] = new GirlFriend("小王",48,"女","逛街");

        int sum = 0;
        for (GirlFriend girlFriend : girlFriends) {
            sum += girlFriend.getAge();
        }
        int avg = sum / girlFriends.length;
        int count = 0;
        System.out.println("平均年龄为:"+ avg);
        for (GirlFriend girlFriend : girlFriends) {
            if(girlFriend.getAge() < avg){
                count++;
                System.out.println(girlFriend);
            }
        }
    }
}
