If you type in a fire department channel on your ham radio to scan and it goes off and you accidentally press the talk button can the firefighters/dispatch hear you?
There are a few different types of radios where this can be done and the answer depends on what type of radio you have (and possibly what type of modifications you made to that radio).
1) Many standard VHF and/or UHF ham radios include extended receive as a standard feature. For those types of radios you can only transmit on the ham bands unless you modify the radio to enable the extended transmit feature.
2) There are some amateur radios that are also Part-90 certified (these are generally those fairly cheap radios from China like the Wouxun and Baofeng brand radios). These are designed to both transmit and receive on both the ham bands and the nearby public service bands. If you happen to press the talk button you will transmit regardless of where you have it tuned to a ham frequency or other frequency like your fire department channel.
3) Often a VHF and/or UHF ham radio can be modified to activate the ability to transmit outside of the ham bands which generally includes the nearby public service bands. This modification generally requires that the radio be opened up and a tiny component removed or possibly shorting two nearby connections using a solder bridge. Once this is done, you can transmit on most any frequency your radio is tuned to. Be aware that this modification only makes it possible to transmit on those frequencies, but since the radio (modified or not) is not certified to transmit on anything but the ham frequencies, it will be against the FCC rules to do so, even with departmental permission.
4) It is often possible to get a standard public service radio to work on a ham frequency. This is quite legal and many hams like the extra ruggedness the public service radios provide. However, generally they must be programmed for where you want to transmit (both frequency and tone) and there isn't the ability to "tune" the radio to frequencies where it isn't already programmed.
I also wanted to know are you only able to hear analog channels or analog and digital on your ham?
As others have said, ham radios are generally analog only, with a few exceptions. DStar is the most popular digital operation on the ham bands and it is not compatible with the public service agency's digital signals. Some groups have modified standard public service digital radios to work on the ham frequencies, but currently this is a rare exception. It is expected that the use of P-25 and MotoTRBO digital signals will increase on the ham bands as the price drops on them and they become more available on the used market.