Lactams are cyclic amides obtained by condensation, with loss of water, of a molecule containing acid and amino groups.

lactams
4-(Aminomethyl)butanoic acid [1] condenses under heating to form N-methylpyrrolidin-2-one [2] , a polar aprotic solvent.
The lactam ring appears in numerous compounds with biological activity, such as penicillins and cephalosporins.

penicillin-cephalexin The peniciclin G molecule is drawn below.