Gravity works on everything that has mass. While Jupiter is made of some solid, liquid and mostly gas, this solid/liquid/gas still has a really really large mass, therefore it also has a large gravitational pull. Jupiter formed the same time as the rest of the solar system did 4.6 billion years ago. A rocky core coalesced and then hydrogen and helium was attracted gravitationally to the core.
Comments