Java OOP homework 2