KBS interview question

java coding