Infosys interview question

Asked on Java patterns