Cognizant interview question

Basic opps concept from java