For example, an oxygen atom. In its second shell it can hold up to eight electrons, but the oxygen atom only has six electrons in its second shell, so it is always looking for more electrons to fill its shell. Now a hydrogen atom it only has one electron in its outer shell, but it can hold 2 electrons in its shell, so it is also looking for more electrons. The oxygen atom binds with two hydrogen atoms to fill its valence shell, sharing one electron from each hydrogen atom. In this way the hydrogen atoms requirement is also fulfilled as they can also fill their capacity shells to their capacity of two electrons in their valence shells. By combining together they create the water molecule.