A classic experiment (I think versions have been posted here before).
Slight correction to the explanation - you didn't just heat the air in the can, you displaced it. The steam from the boiling water replaced the air. When you cooled the can, the vapour condensed, decreasing in volume dramatically, creating a vacuum.
You don't need the ice for it to work, cold tap-water is fine, and if you use deeper water, you sometimes get a satisfying smack sound as the water rushes in and hits the inside surface of the can.
Slight correction to the explanation - you didn't just heat the air in the can, you displaced it. The steam from the boiling water replaced the air. When you cooled the can, the vapour condensed, decreasing in volume dramatically, creating a vacuum.
You don't need the ice for it to work, cold tap-water is fine, and if you use deeper water, you sometimes get a satisfying smack sound as the water rushes in and hits the inside surface of the can.