solution for 1task about java