Morgan Stanley interview question

Correct the Java code below