LogiCoy interview question

based on Java and programming