There are hundreds of bears in Yosemite, and all of them want your sandwich. How can you prevail against such overwhelming odds?
It might not be easy, but you'll have to find a way. Bears that become acclimated to humans, and especially bears that learn to see humans as a food source, become dangerous and end up getting bumped off by the park service. No matter how noble your aspirations for interspecies understanding, bears, like supernovae, Miss Universe, and people surrounded by Secret Service agents, must be admired from a distance.
The park service goes to some length to help you keep your food away from the wildlife. Campgrounds, parking lots, and trailheads are littered with bearproof storage lockers in which you can store food or any other items that give off an odor (deodorant or sunscreen, for instance). Leaving such stuff unattended in your car overnight or while you're off hiking can lead to unhappy scenes. The park service will issue tickets if they notice coolers or food left behind in a car for long periods. And if bears notice it, they'll peel your car like an orange to get at the food. At the visitor center in Yosemite Village, a video screen permanently loops a film of a bear more or less eliminating a car's resale value just for the sake of a loaf of Wonder Bread left inside. It's worth checking out.
The trash dumpsters with the hooded tops that resemble Half Dome have clips for locking them shut, and you're encouraged to use them. Mother bears will help their cubs climb into unclipped dumpsters so they can push food out to mom and the rest of the family. Unfortunately, the cubs usually can't get out again, and will next be seen peeking out the top of a trash truck en route to the incinerator.
You need to take extra precautions when you're backpacking, too, because the Yosemite bears really are smarter than your average bear. Food and supplies hung from a suspended rope might puzzle a backwoods grizzly in Yellowstone or a remote Kodiak in Denali, but they're no challenge for the ultra-hip black bears of Yosemite. Instead, you need to carry special bearproof containers, which you can rent at the park.
It will, one hopes, go without saying by now, but please don't encourage bears to eat RV drivers who ignore the slow-vehicle turnouts. In the long term, it will just lead to trouble for the bears.