Accenture interview question

Java related question