Anything less dense than water will float, like oil. Anything more dense than water will sink, like rock.
Oil floats on water because it has a lower density than water. This means for the same volume, oil weighs less than water, allowing it to remain on the surface. This principle of density and buoyancy explains many similar phenomena in nature.
;