From what I know of Yosemite black bears, the rangers suggest that you throw stuff at them and let them know they are unwelcome. I did that to a black bear that I ran into once in Yosemite, who was circling my campsite. He finally freaked out when one rock got too close to him and he charged. Luckily, it was right at a tree and he climbed it 20 feet up in about 3.3 seconds. Those things can move! Generally speaking though, black bears are not a threat to humans. Every once in a while somewhere in North America, a black bear will freak out and kill someone. But that is akin to a lightning strike or shark attack.