Aptean interview question

Cricket Rules code in java