exercise on Java Control Structures