DS Group Interview Question

They asked me about the basic oops and java problem