Second java homework