It will be explained by law of constant composition.
H2O contains , 2 g of hydrogen and 16 g of oxygen .
Therefore , the hydrogen to oxygen ratio is = = 1:8 by mass
Now , percentage of oxygen in H2O = = 88.89 %
Percentage of hydrogen in H2O is = = 11.11 %
Hence , both the values are coming constant. Therefore , it will obey law of constant composition.