Jem actually learns two lessons.
One: You must take the consequences for your actions. After he cuts off the tops of the flowers at Mrs. Dubose's home, Atticus sends him back to talk with her. He (Jem) returns with the information that he is going to work in her garden every Saturday until the flowers bloom again, and he cleaned up her yard. She also asked him to read to her every afternoon. That was the part that upset him the most. Atticus tells him,
"Jem, she's old and ill. You can't hold her responsible for what she says and does." (pg 105)
Later, Scout tells the readers that,
"Jem's chin would come up and he would gaze at Mrs. Dubose with a face devoid of resentment. Through the weeks he had cultivated an expression of polite and detached interest, which he would present to her in answer to her most blood-curdling inventions." (pg 110)
However, the greatest lesson Jem learned was after Mrs. Dubose died. Atticus, at that time, chose to tell the children that Mrs. Dubose was a morphine addict. She had taken the drug for years when it was prescribed by her doctor for pain. She could have continued its use and died without so much agony, but she wanted to be free from the drug when she died. She had a very painful and horrible death, but died "beholden to nothing and nobody" (pg 112) . Atticus tells Jem,
"I wanted you to see what real courage is, instead of getting the idea that courage is a man with a gun in his hand. It's when you know you're licked before you begin, but you begin anyway, and you see it through no matter what." (pg 112)
Atticus called her the bravest person he ever knew. However, if you look at Atticus and his battle to save Tom Robinson, you will see that he too knew he was licked before he began, but he began it anyway, and saw it through to the end.