S&P Global interview question

puzzles question basics of OOPS java CN