I see you're reading 'The Catcher in the Rye'. That's quite a challenge! Some of the 1940s colloquialisms in it are fairly obscure, even for native speakers.
'Getting the ax' usually means getting expelled, or fired from a job. In this case, it probably means getting thrown out of the class.
The phrase "cold as a witch's teat" isn't from any particular literary source, but it is a well-known simile which has fairly old origins. To describe extreme situations, especially those to do with heat and cold, it has always been common to refer to either satanic topics (devils, hell, witches) and so on, or intimate body parts (specific male or female appendages). This expression is particularly appealing, as it ticks both boxes.
In the 1940s, censorship laws didn't allow obscenities or profanities in published materials, so this colourful language is the nearest that Holden Caulfield could get to swearing.