Prince William (search) learned Saturday that he had achieved a master of arts degree in geography.

The 22-year-old son of Prince Charles (search) and the late Princess Diana (search) logged onto the Internet to discover that he had received a 2:1 grade for his four-year course at St. Andrews University, Scotland.

A 2:1 denotes an upper second-class degree, a very respectable achievement.

The prince, who is second in line to the British throne, did better than his father, who received a 2:2, or lower second class degree for his honors degree in history at Trinity College, Cambridge.

"William got an upper second class honors (degree). He's delighted. Everyone is absolutely delighted. His father's very proud," said a spokesman for Charles's Clarence House office.

William said last year that he was hoping to get a 2:1 but a lot depended on his 10,000-word dissertation on coral reefs.

The prince, who turns 23 later this month, had a somewhat rocky start to his academic life in the isolated Scottish town in Fife.

In his first term, he struggled to adjust but eventually settled down after switching his course from history of art to geography.

St. Andrews became a haven for the prince, with the media largely adhering to his father's request that he be left alone during his studies. Locals grew used to having a royal around town.

William, who will graduate at the end of June, plans to sign up for military training at Sandhurst, the prestigious military academy south of London where his younger brother, Harry, began his studies last month.