The chemical bond formed by sharing of two valence electron between the two atoms is called covalent bond. It is also known as molecular bond.
For example: Molecules that have covalent linkages are hydrogen H2, nitrogen N2, chlorine Cl2, water H2O, and ammonia NH3.
A single line indicates a single bond between two atoms (i.e. involving one electron pair), double lines (=) indicate a double bond between two atoms (i.e. involving two electron pairs), and triple lines (≡) represent a triple bond (C≡O).
1) Hydrogen molecule is formed by covalent bonding.
Atomic number of hydrogen is 1, its atom contains 1 electron in K shell. It requires one more electron to complete the K shell and attain the configuration of helium (He). To meet this requirement two hydrogen atoms share their electrons with each other to form H2 molecule. One covalent bond, that is a single bond is formed between two hydrogen atoms by sharing of two electrons.
2) The atomic number of oxygen is 8. The electronic configuration is (2,6) Oxygen has 6 electrons in the outermost shell.
It requires 2 electrons to complete the L shell and attain the configuration of neon(Ne) The O2 molecule is formed by chemical combination of two oxygen atoms; On drawing the electron-dot structures of these two molecules, it becomes clear that the two oxygen atoms in O2 molecule are joined with each other by two covalent bonds, that is, a double bond.