@
Andromedanian 1/2 right.
The water doesn't overflow, that's true.
But the it isn't the same quantity of water, even if you made an exact bit of ice which you could completely slide into the glass. Why? Well, see (for instance) @
PhoenixPhail's answer, but you already know this.
Ask yourself if ice sinks or "swims"...?
It floats, right? So H2O is an oddball substance which EXPANDS when it freezes: a given mass of water goes UP in
volume when it freezes, so the
density (mass per unit volume) goes DOWN.
So the
(density of ice) < (density of liquid water)
which is why it floats.
AND why a glass even
completely full of ICE has FEWER H2O molecules than the
same glass when it is
completely full of liquid water.
It's a great question to make people think, and to which we all know the answer, if we just stop and think about a drink with ice.
Does that make sense?