@AdilMohammed The elctromagnetic field (especially in closed system) can be decomposed into spatial modes (decomposition of solutions to Helmholtz equation). This is especially salient when you have closed boundary conditions like a cavity because the mode is physically confined in space.
In classical E&M any one of those modes can have arbitrarily small or large energy (and correspondingly large E and B field amplitudes). However, in quantum mechanics, the total energy (for standing waves) or intensity (for travelling waves) in the mode is quantized.