S&P Global Interview Question

puzzles question basics of OOPS java CN