Electron affinity is defined as the change in energy (in kJ/mole) of a neutral atom (in the gaseous phase) when an electron is added to the atom to form a negative ion. Halogens have the greatest electron affinity as by gaining one electron, they attain noble gas configuration. Thus, from the given elements, fluorine has the maximum electron affinity.