Accenture interview question

Java oops concepts Coding question