Java assignment 2