The atomic number of hydrogen is 1 so it has 1 electron in its outer shell.
The atomic number of oxygen is 8 so it has 6 electrons in its outer shell.
Oxygen can share 1 electron with one hydrogen atom, with has the effect of allowing all atoms to have a complete outer shell.