Capgemini interview question

Basic Java question with follow ups