There are many ways to get levels. There are mining certain ores, fighting mobs, smelting things in a furnace, and trading! The fastest way of getting experience can be summed up into one word. Farms! No, I do not mean like food farms, but mob farms where you can trap mobs just to kill them and earn that easy experience. That is only one of the many farms you can make.

Another version of a farm is the smelting farm. In this farm, you can use hoppers to automatically smelt things and all you have to do is collect them, and you are able to get very big amounts of experience from that.

Trading can be a farm, but you will not earn a lot of experience as villagers can run out of the item you are trying to trade for. Mining cannot be farmed as you can only get experience from coal, diamonds, and emeralds and cannot give more than what you are usually able to receive.