Black bears inhabit much of the North American wilderness, especially the highlands, and sometimes stray into inhabited areas. Despite their name, they can be any color from black to nearly white, so they're sometimes mistaken for the larger, more aggressive brown bear found only in Alaska and the Rocky Mountains. The difference is important because black bears are far less aggressive than brown bears.
Black bears only attack for two reasons: to defend themselves, or for food. Know how to avoid putting a black bear in either situation and you will avoid a black bear attack.
Black bears do not want to encounter humans. As you travel, make unthreatening noises continuously. Carrying on a conversation is enough. Sing. Wear a bell. Kick small rocks. Be visible but not flashy. Walk in groups of two or more. Keep young children within grasp at all times. You want any nearby bear to think you're invulnerable but not threatening. Black bears will typically leave the area when they hear you approaching. Coincidentally, this is a good strategy for avoiding snakes as well.
While black bears will shy away from you, some may be eager to make contact with your food supply. Whenever possible avoid carrying food, or carry it in factory-sealed packages. Never sleep where you have just eaten. Most importantly, never make human food available to a black bear. Don't leave it on the ground or in an open waste receptacle. Don't try to redirect a bear's attention by throwing food in its path; all it will know is that you are throwing something at it, and it will attack; or, it will think that you have more food and it will still attack.
If you spot a black bear, consider yourself fortunate! But before you unpack photography equipment, acquire a safe distance. Never turn your back on a bear, especially if he sees you. Back away at a steady pace as a group until you're at least fifty yards away. When he sees that you don't intend to approach him he'll probably ignore you. If he moves toward you, continue to back away until you have good distance.
Rarely, a black bear will bluff charge. That is, he will rush toward you in an attempt to chase you away. When this happens you must stand your ground. Become big and loud. Wave sticks, throw rocks, bang pots, blast an air horn, and yell. If he does not retreat, and if he charges to within thirty feet, you will have to use bear spray. Bear spray is a potent "pepper" spray, and is not permitted on commercial flights. This should deter him long enough for you to continue backing away.