How are we able to determine that jupiter is mostly methane gas and that the surface of the sun is mostly He and H? can anyone help me pls.

I found this by typing into google "composition Jupiter atmosphere" without the quotation marks.

http://www.enchantedlearning.com/subjects/astronomy/planets/jupiter/jupiterinside.shtml

You can do the same for the sun.