The Meaning of Numbers: The Number 40
  Mentioning  146 times in Scripture, the number 40 generally symbolizes a period of  testing, trial or probation.  During Moses' life he lived forty years in  Egypt and forty years in the desert before God selected him to lead his  people out of slavery. Moses was also on Mount Sinai for 40 days and  nights, on two separate occasions (Exodus 24:18, 34:1 - 28), receiving  God's laws. He also sent spies, for forty days, to investigate the land  God promised the Israelites as an inheritance (Numbers 13:25, 14:34).
The  prophet Jonah powerfully warned ancient Nineveh, for forty days, that  its destruction would come because of its many sins. The prophet Ezekiel  laid on His right side for 40 days to symbolize Judahs sins (Ezekiel  4:6). Elijah went 40 days without food or water at Mount Horeb. Jesus  was tempted by the devil not just three times, but MANY times during the  40 days and nights he fasted just before his ministry began.  He also  appeared to his disciples and others for 40 days after his resurrection  from the dead.
The number forty can also represent a generation of  man. Because of their sins after leaving Egypt, God swore that the  generation of Israelites who left Egyptian bondage would not enter their  inheritance in Canaan (Deuteronomy 1). The children of Israel were  punished by wandering the wilderness for 40 years before a new  generation was allowed to possess the promised land. Jesus, just days  before his crucifixion, prophesied the total destruction of Jerusalem  (Matthew 24:1 - 2,  Mark 13:1 - 2). Forty years after his crucifixion in  30 A.D., the mighty Roman Empire destroyed the city and burned its  beloved temple to the ground.