Java assignment ex1