Quantum confinement occurs when the dimensions of a material are reduced to the point where the electrons are confined to discrete energy levels. This phenomenon affects the electrical conductivity and resistivity of nanomaterials. For instance, in quantum dots and nanowires, the energy levels are quantized, which can lead to a change in the density of states and, consequently, the resistivity.