Simple java exercises