The thermal energy produced for an AC circuit in one time period is given by,
For current, i1 = i0 sin ωt,
For current, i2 = −i0 sin ωt,
Hence, the same thermal energy will be produced due to this current.
Since, the direction of i1 and i2 are opposite and their magnitude is same, the net current through the resistor will become zero when both are passed together. Yes, the principle of superposition is obeyed in this case.