Farming Sheep, Cows and Pigs in Minecraft
Farming cows and pigs will provide a ready source of meat for food. Cows also provide leather, which can be made into armor, and can be milked by right-clicking on them whilst holding a bucket.
Sheep provide wool, but nothing to eat.
The same techniques also apply to chickens, but they also lay eggs, which is an easier way to increase their numbers.
What you will need
The essential thing you will need for farming is food for the animals. Get some of that before you start!
Cows and sheep eat wheat. Pigs eat carrots. Chickens eat seeds (from wheat or long garss)
How to build the farm
Build an enclosure
First you will want to build an enclosure, either a small pen or a large field, in which to keep your animals. This can be indoors or outdoors, but it needs to be somewhere that you can lead the animals to, so outdoors is easier. If you're raising sheep for wool, you will want a grass floor so that they can eat and regrow their wool.
Fences and Gates
Fences form a barrier that is 1½ blocks high, so that mobs (or players) can't jump over it. Fences are crafted from wooden sticks, and automatically connect together when placed next to each other. Gates act as a way to get through fences, and are opened or closed with a right-click.
You can just fence off an area and build a gate to get in and out, but if you build so that the ground is higher on the inside than the outside, then you can make an animal pen that is easy to get into from any direction but needs a gate to get out.
Find some animals
(you'll note I'm leading pigs around with wheat here: these are old pictures, you'll need carrots)
Now you need to find some animals! The example here is pigs, but it's the same for sheep or cows. Just like in the real world, you will need two of them. There's no male and female in Minecraft; any two of the same species will do.
Lead the animals home
Holding some wheat, approach the animals. When they notice the wheat, they will look at you and follow you. Lead them back to their new home!
If you built the kind of pen suggested above, you should be able to get them in without having to enter the pen yourself. Otherwise, lure them in through the gate. If you select something other than wheat in the toolbar before leaving, they will not try to follow you on the way out.
To get your animals to breed, you just need to feed them. Right-click on an animal whilst holding wheat, and hearts will appear above its head so show that it's in the mood. Right-click on another animal nearby, and, well, nature will take its course.
Next something complicated to do with birds and bees and storks and cabbage-patches will happens. Mercifully we don't need to know about all that, we just get to see the results. Awwww!
Until the baby grows up, the adults will not respond to further attempts to make them breed. However, pretty soon you will have four animals that can be bred, and you will quickly be able to raise a large herd.
The most efficient way to harvest meat from your cows and pigs is just to enter the pen, equip a sword and slay all of them except a few that you save for breeding the next herd. If you kill pigs by setting them on fire, then your porkchops will be ready-cooked, but you will have to live with the knowledge that you are a horrible person.
Sheep can be relieved of their wool using a pair of shears. If you want coloured wool, you can dye the sheep first for greater efficiency. Sheep don't regrow wool after shearing, so what you do with them then is your own business.