In O2 molecule, number of electrons = 16
So the filling of electron in molecular orbitals are possible as follows :

(where Nb → No. of electrons in bonding orbitals) Na → No. of electrons in antibonding orbitals
In it two unpaired orbitals are present, so it shows paramagnetic character.