Java Exercises in Class