Sankey Solutions interview question

Oops concept basic java questions