Mass measures the amount of matter in the substance.
Density shows the amount of matter in a given space for a substance.
Therefore meaning they both have the same mass yet the solid ball is more dense than the hollow ball.
Also the hollow ball would be filled with something such as air which would affect its buoyancy in water.