Java homework №3