the nerve endings in your hand are rejestering the hard surface of the table and the nerves are sending pain signals to your brain so you wont do it againt
This a reaction from our nerves. The nerves send this as a response to thinking it’s something much worse. They send signals to your brain to not do it again.