How many electrons are being shared in O2?
O2 is diatomic oxygen, or, two oxygen atoms that are bound to each other. Each oxygen normally has 6 valence electrons which are available for bonding, but it wants access to 8; this is the "octet rule." Typically, bonds will favor arrangements that follow the octet rule as closely as possible, and this is why we rarely see a variety of bond types when those varieties violate the rule.
Each bond between atoms involves two electrons, so that both atoms essentially have access to both and can be considered to have two electrons per bond, even though this isn't really the case; it's just better than nothing, and gets the atom closer to satisfying its octet. In the case of the oxygen atoms, each of which has 6 electrons, a single bond would "cost" one electron in exchange for two. This would mathematically give us 6 -1 +2 = 7. The atoms would be happier with a single bond, but their octets still aren't satisfied.
If the oxygen has a double bond, this means each oxygen would "lose" two electrons, but gain four. This gives us 6 -2 +4 = 8. Therefore, the oxygens will be happiest with a double bond, which satisfies their octet.
Therefore, four electrons are shared between them.
check Approved by eNotes Editorial