exercise for java programming