NTT DATA interview question

Java basics