In a double displacement reaction,
Example: Na2SO4(aq)+BaCl2(aq)→BaSO4(s)+2NaCl(aq)
In the given equation, sodium sulphate (Na2SO4) and barium chloride (BaCl2) are exchanging their ions (both cations and anions) to form barium sulphate (BaSO4) and sodium chloride (NaCl).