Exercies for java class