An increasing number of young massive clusters (YMCs) in the Magellanic Clouds have been found to exhibit bimodal or extended main sequences (MSs) in their color-magnitude diagrams (CMDs). These features are usually interpreted in terms of a coeval stellar population with different stellar rotational rates, where the blue and red MS stars are populated by non-(or slowly) and rapidly rotating stellar populations, respectively. However, some studies have shown that an age spread of several million years is required to reproduce the observed wide turn-off regions in some YMCs. Here we present the ultraviolet-visual CMDs of four Large and Small Magellanic Cloud YMCs, NGC 330, NGC 1805, NGC 1818, and NGC 2164, based on high-precision Hubble Space Telescope photometry. We show that they all exhibit extended main-sequence turn-offs (MSTOs). The importance of age spreads and stellar rotation in reproducing the observations is investigated. The observed extended MSTOs cannot be explained by stellar rotation alone. Adopting an age spread of 35-50 Myr can alleviate this difficulty. We conclude that stars in these clusters are characterized by ranges in both their ages and rotation properties, but the origin of the age spread in these clusters remains unknown.