Answer: they can be formed in many ways.
Step-by-step explanation:
The main way though is by tectonic plates. When they move, they can create cracks in the earth which causes magma to flow out of, which in turn slowly builds up over time eventually breaking the surface of an ocean or sea and finally becoming lush with greenery.