Exercice for learning Java