Yes, it’s a fairly common thing to do during the summers. Berkeley won’t allow you to do it during the school year. You might say to yourself “well that’s obvious”, but nowadays there are tons of online classes that can be taken at a community college that would be tempting.
FWIW, my kid will have 44 semester units, all transferable to UC schools, from his community college and another 30-40 semester units from his AP classes going into Berkeley this fall, as a freshman. However, that doesn’t mean he’s going to graduate in 2 years (around 120 needed to graduate). All kinds of major requisites and pre-requisites, some college requisites, class availability, and the like probably will trip him up and extend things way out. Some of those CC or AP units possibly will be “wasted” as well, as there may be instances where it would do a student good to take the class at Berkeley again.