Collabera interview question

Oops java and c++