package ru.apetrov.user;

import java.util.Calendar;

/**
 * Created by Andrey on 10.04.2017.
 */
public class User {

    /**
     * user name.
     */
    private final String name;

    /**
     * amount of children.
     */
    private final int children;

    /**
     * birthday of user.
     */
    private final Calendar birthday;

    /**
     * Constructor of class.
     * @param name user name.
     * @param children amount of children.
     * @param birthday birthday of user.
     */
    public User(String name, int children, Calendar birthday) {
        this.name = name;
        this.children = children;
        this.birthday = birthday;
    }

    /**
     * getter.
     * @return name.
     */
    public String getName() {
        return name;
    }

    /**
     * getter.
     * @return amount of children.
     */
    public int getChildren() {
        return children;
    }

    /**
     * getter.
     * @return birthday of user.
     */
    public Calendar getBirthday() {
        return birthday;
    }
}

package ru.apetrov.user;

import java.util.Calendar;

/**
 * Created by Andrey on 10.04.2017.
 */
public class User {

    /**
     * user name.
     */
    private final String name;

    /**
     * amount of children.
     */
    private final int children;

    /**
     * birthday of user.
     */
    private final Calendar birthday;

    /**
     * Constructor of class.
     * @param name user name.
     * @param children amount of children.
     * @param birthday birthday of user.
     */
    public User(String name, int children, Calendar birthday) {
        this.name = name;
        this.children = children;
        this.birthday = birthday;
    }

    /**
     * getter.
     * @return name.
     */
    public String getName() {
        return name;
    }

    /**
     * getter.
     * @return amount of children.
     */
    public int getChildren() {
        return children;
    }

    /**
     * getter.
     * @return birthday of user.
     */
    public Calendar getBirthday() {
        return birthday;
    }

    /**
     * hash code.
     * @return hash code
     */
    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + children;
        result = 31 * result + (birthday != null ? birthday.hashCode() : 0);
        return result;
    }
}

add lesson 5.5.3 - Main