Capgemini Engineering interview question

java oops concepts