WRT firearms, certainly they offer the best defence against any aggressive animal. But do not let your reaction be to "get out the gun" (you certainly should get any responsible adult to ready it for you) as your immediate aggressive response is the most effective.
I have been in a situation in camp where another person fumbling with a gun delayed our response, and it could have been dangerous as there were "civilians" nearby whom were in the most dangerous position relative to the bear. From that point on I never bothered with firearms as my first response, even when available, and it always worked out fine.
Those were always situations where we had chased the bear previously (remember the part about returning to previous locations) and had secured permission to shoot from the Conservation Officer. We only occasionally did, and there were multiple encounters ... maybe even more than I had ... many with camp staff (including young women). Properly advised the people in camp always reacted appropriately and we never had a serious encounter.
Just as with my own experience, they were sometimes within spitting distance apart.
I once hit a bear on the head with a frying pan, as he surprised us while cooking lunch out in the bush. He ran away.
Another time we were waiting to be picked up from the aircraft, and we had a persistent bear, and he was a nice sized boar. There was a hill that crested about 20 yards away. The bear would come over the hill, and start down somewhat to our left, we'd chase it, it would go behind the hill and then approach from the right, we'd chase it, and it would come again from the left. (Very typical behaviour).
At one point it stood at the crest of the hill (well, not stood, on all fours). Another person (not me) picked up a potato-sized rock and nailed him right on the nose. You would have thought he was wailing at a funeral, he yelled so loud, and we had a quiet half hour or so with no more encounters until the floatplane arrived.
So, hit him on the nose.
If you do feel it necessary to shoot, do not aim for the head; most bullets will not penetrate that skull. I would not count on a 9mm doing so, for example. Aim for the body, lungs and heart, as usual with animals.