You can use several methods like, charge on the ion, compound, or lewis structure (of electron sharing covalent bonds) to find the oxidation states of the elements in side a compound.
You can sum up oxidation states of atoms inside the compound to get the ionic charge or oxidation state of the compound.
oxidation state of Hydrogen is +1. So carbon has -4 in compounds like CH4. But it has different oxidation states in different compounds.
CH3 has a charge +1 and it exists in gaseous form and is produced in ionic form when a proton reacts with methonol. Its oxidation state will be +1. The ion CH3 forms a compound methyl iodide, CH3 I. Iodine has an oxidation state -1. Hence CH3 has an oxidation state +1.
COOH - has a structure : O = C - O - H.
As oxygen has an oxidation state -2, and hydrogen has +1, OH has -1. The other oxygen and hydroxide combined have 3 bonds with C. One electron is there for sharing with C. Hence, it has -1 oxidation state. It forms compounds H- COOH (methonoic acid) and CH3 - COOH (acetic acid).