This is actually a very tough question. Firstly, when a solar system is made, the planets in the middle are made of rock and the planets on the outside are made of gas. This is because the gases all evaporate on the warm planets and most of the gas gets pushed further out of the solar system. When Jupiter was made, it was at just the right distance where a lot of the gas was which made it become the gas giant that it is today.
Comments