A p-type semiconductor is formed by doping a group 13 element with group 14 element (Si or Ge). As the group 13 element has only 3 electrons in its valence shell and the group 14 element has 4 electrons in its valence shell, when the group 13 element, say, Al, replaces one Si in the silicon crystal, only 3 covalent bonds are formed by it. And the fourth covalent bond is left in need of one electron. So, it creates a hole. Since the atom as a whole is electriclly neutral, the p-type semiconductor is also neutral.In a p‒n junction, when the diffusion of holes takes place across the junction because of the difference in the concentration of charge carriers from p to n sides, these holes neutralise some of the electrons on the n side. So, the atom attached with that electron becomes one electron deficient and hence positively charged. This makes the n side of the p‒n junction positively charged and the p side of the p‒n junction negatively charged.