small class project in Java