Answer :

The nucleus consists of protons and neutrons. Since neutrons are neutral, they are not taken account of in the net charge. The number of protons = the net charge of the nucleus and that is shown by the atomic number. For example, the atomic number of Oxygen is 8 which means that it has 8 protons; a net charge of +8 only in the nucleus. On a deeper note, a neutral atom has the same amount of protons as electrons, so theoretically, oxygen is supposed to have 8 valence electrons, but sometimes it has a deficiency of 2 electrons (making an oxygen ion), so the net charge would be -2 of the whole atom (since it's supposed to be neutral), but the net charge of the nucleus itself would still be +8.