Pergunta de entrevista da empresa Bloomberg

Given Java code, why does it not execute as it should