As a Harvard dropout, Bill Gates wasn't exactly a model student.

But as the second-richest person on Earth — and someone who is heavily involved in efforts to alleviate poverty and health burdens for billions of people — he does know thing or two about finding success.

The Microsoft cofounder has given students his fair share of advice over the years through interviews, commencement speeches, and social media.

Here are some of Gates' best nuggets of wisdom for those on the verge of entering the real world.

Artificial intelligence, energy, and biosciences make good majors.

At the end of the 2017 school year, Gates wrote in a Twitter thread that incoming college freshmen would do well to study one of those three majors, given how relevant they'll be in the coming decades.

He called them all "promising fields where you can make a huge impact."

Surround yourself with people who challenge you.

In the same Twitter thread, Gates advised students to be intentional about who they spend time with in the pursuit of growing and getting better.

It echoed what his best friend Warren Buffett has said, —namely that "You'll move in the direction of the people you associate with," so choose wisely.

For Gates, that person is his wife of 23 years, Melinda.

Trust that the world is getting better and can be improved further.

Contrary to how it sometimes seems, Gates likes to remind people that the world is the best it's ever been. He frequently recommends the book "Better Angels of Our Nature," by cognitive scientist Steven Pinker, as proof.

"If you think the world is getting better, you want to spread the progress to more people and places," he said. "It doesn’t mean you ignore the serious problems we face. It just means you believe they can be solved."

Optimism can take you far.

The wisdom in that message is another profound one: Optimism can lead to action.

Together with Melinda, Gates remarked in their 2014 Stanford commencement address that "even in dire situations, optimism can fuel innovation and lead to new tools to eliminate suffering."

The catch, he said, is that "if you never really see the people who are suffering, your optimism can't help them."

Have convictions, but always stay curious.

Gates considers himself a lifelong learner. He'll typically read about 50 books a year.

Often, those books will inform his view of the world. But occasionally something will shatter that view, and he'll need to rethink his perspective. It's something he told Columbia University students to try out for themselves.

"You try and predict what's going to happen," he said, "then when it doesn't, you think: What is it about my model of the world that's wrong?"

Take time to think about the world's inequities.

Gates has told students on numerous occasions that one of his big regrets upon leaving Harvard was his lack of awareness of the world's imbalances in health, wealth, and resources.

In his 2007 Harvard commencement speech, Gates told graduates to consider the responsibility of being so aware of those realities and perhaps even correct them.

"I hope you've had a chance to think about how, in this age of accelerating technology, we can finally take on these inequities, and we can solve them," he said.