Hammocks are just as safe (or as vulnerable) as tents, but there are great ways to minimize your risks outdoors.
NEVER EVER sleep near or downwind from "smellable" items like food, kitchen items, food-soiled clothing etc. Keep a pair of clean sleeping clothes separate from your hiking clothes that you change in to when you go to bed.
Animals are attracted by smell, primarily.
In wilderness areas where animals are still afraid of humans, you can often scare them away with sounds or sights. I've seen and read about places on the AT where the bears simply ignored hikers as they clawed through backpacks.
Hang or securely cache your food at least 200 feet away and downwind from your sleeping area.
Thanks dejoha. Those are really good tips. I practice almost all of them - keeping food in a cache, not eating or washing dishes in my campsite etc., but the keeping sleeping clothes separate is a great point - a bit difficult on a long hike, but still very smart. I have been lucky enough not to have any trouble so far - even after finding an empty tuna wrapper in my pack one morning! I hope those aren't famous last words! Thanks again!