@@ -0,0 +1,1116 @@
+package ru.job4j;%0A%0Aimport org.junit.Test;%0A%0Apublic class HashCodeTest %7B%0A    public static final class User %7B%0A        String name;%0A        int age;%0A%0A%0A        public User(String name, int age) %7B%0A            this.name = name;%0A            this.age = age;%0A        %7D%0A%0A        @Override%0A        public int hashCode() %7B%0A            int result = 17;%0A            result = 31 * result + (name != null ? name.hashCode() : 0);%0A            result = 31 * result + age;%0A            return result;%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void example() %7B%0A%0A        HashCodeTest.User user1 = new HashCodeTest.User(%22Anton%22, 22);%0A        HashCodeTest.User user2 = new HashCodeTest.User(%22Anton%22, 22);%0A%0A        String str = new String();%0A        HashCodeTest.User user3 = new HashCodeTest.User(str, 0);%0A%0A        System.out.printf(%22user1.hashCode() = %25d %25n%22, user1.hashCode());%0A        System.out.printf(%22user2.hashCode() = %25d %25n%22, user2.hashCode());%0A        System.out.printf(%22user1.hashCode() == user2.hashCode() = %25b %25n%22, user1.hashCode() == user2.hashCode());%0A%0A        System.out.printf(%22user3.hashCode() = %25d%22, user3.hashCode());%0A    %7D%0A%7D%0A

task 9881