A person does not gain or lose a domicile solely by reason of his or her presence or absence from a place while employed in the service of the United States or of this state, nor while engaged in navigation, nor while a student of any institution of learning, nor while kept in an almshouse, asylum or prison. This section shall not be construed to prevent a student at an institution of learning from qualifying as an elector in the locality where he or she domiciles while attending that institution, when in fact the student has abandoned his or her former domicile.
Ca. Elec. Code § 2025