Compared to activities like scuba diving or skiing, long-distance walking is very cost-effective, but you still need to do a bit of homework before setting out; it can be incredibly frustrating to run out of money, especially if you're trekking through the middle of nowhere and there are no banks for miles.
The first thing to do is to estimate how much you think your trek will cost. Try to think of everything that might cost money – park fees, accommodation or campsite fees, food costs, cooking costs, walking permits, transport to and from the walk, and so on – and add them up for your whole trip. Now add a bit for emergencies (say another 25%), and see what you come up with. This is the cost of your trip.
Next you need to work out how you're going to carry this amount of money. If you're heading off into the middle of nowhere and there are no banks, then you're going to have to carry it in cash. If you're in the developing world it's a good idea to try to get notes in small denominations, as getting change can be next to impossible. Split your cash up into a couple of waterproof plastic bags and keep them separate (in two different backpacks, if that's possible), and only keep a small amount in your wallet; pulling out a whole wad of notes is a bad idea regardless of where you are.
If you are planning to visit banks along the way, or somewhere that can cash travellers cheques, then that's handy. However, bear in mind that rural banks often have restricted opening hours, and make sure you take the day of the week into consideration; if you're hoping to cash a cheque on a Sunday, you'll probably end up being disappointed. When I walked from Land's End to John o'Groats I opened a National Savings account so I could take money out of Post Offices along the way; I never actually needed to use it, but it was a great comfort out in the countryside where the banks are few and far between.
Remember that the point of long-distance walking may be to get away from all the trappings of our capitalist society, but you can only do that if you plan your finances correctly. I've met walkers in the middle of the Himalayas whose travellers cheques were no good in the local bank; don't fall into the same trap, or it could ruin your walk.