Capgemini interview question

Java logical program and selenium code