Is Jupiter made entirely out of gas? I heard that Jupiter is made out of gas. But in school I learned that Jupiter has gravity which is 2.5 times that of Earth (Gravity that can tear apart a comet) and gravity is proportional to mass.

So if Jupiter is made out of gas alone, how does it have such high gravity and maintain so many moons around it?
It doesn't matter if the body is made of gas, rocks, liquid or plasma, the four states of matter all have mass. So, as we know, mass create a gravitational field, and the more mass the stronger the gravity - and Jupiter has 317x Earth mass.