The high school class of 2020 was sent off with a memorable, albeit virtual, ceremony Saturday night, broadcast across TV stations nationwide.
"I couldn't be prouder with all of you in the graduating class of 2020," he said. "Graduating is a big achievement under any circumstances. Some of you have had to overcome serious obstacles along the way. ... And just as you're about to celebrate having made it through, just as you've been looking forward to proms and senior nights, graduation ceremonies, and -- let's face it -- a whole bunch of parties, the world has turned upside down by a global pandemic."
"I know that not sitting there and having to listen to a commencement speaker isn't all that bad," he joked, adding that he knew his speeches were always too long.
He said the class would have to grow up faster than before, alluding to economic disparity, systemic racism and a lack of basic health care.
"It's woken a lot of young people up to the fact that the old ways of doing things just don't work," Obama added. "And it doesn't matter how much money you make if everyone around you is hungry and sick. And that our society and democracy only work when we think not just about ourselves, but about each other."
Special guests included LeBron James, Malala Yousafzai, the Jonas Brothers, Yara Shahidi, Bad Bunny, Lena Waithe, Pharrell Williams, Megan Rapinoe, H.E.R. and Ben Platt. The event is being hosted by XQ Institute, The LeBron James Family Foundation and The Entertainment Industry Foundation.
"In our poorest neighborhoods in America, school is about much more than learning," James said, after being introduced by a student from the I Promise School he founded in his hometown of Akron, Ohio. "Our schools are our safety net. ... It's time to chase every dream."
"This is your moment and it is unlike any we have ever see before," U.S. women's soccer team member Megan Rapinoe told viewers. "I'm not gonna ask you to come together, I'm gonna ask you to demand better -- together."
Rapinoe also encouraged the class of 2020 to vote in November.
"Who is leading matters," she added.
Platt, and his brothers Jonah and Henry, sang a cover medley, including The Beatles' "In My Life," Wiz Khalifa's "See You Again" and Green Day's "Good Riddance (Time of Your Life)."
Yousafzai warned of children worldwide who would never return to classrooms after the COVID-19 pandemic, saying they would be forced into marriages or low-paying jobs. "Don't leave them behind," she pleaded.
The Jonas Brothers closed out the show with a performance of their new song, "X," featuring Karol G.
"This will be a moment to come together -- as one nation -- to applaud this rite of passage. We hope you’ll join us in celebrating the Class of 2020’s achievements," according to the event's official website. "We've been coping with this crisis together. Now it's time to look ahead together. Let's start by celebrating the graduates of the Class of 2020 and the pivotal role they will play in rethinking and reshaping the path forward."
In addition to being on ABC, the ceremony aired on CBS, Fox and NBC as well as other broadcast and digital streaming partners. The one-hour event was titled "Graduate Together: America Honors the High School Class of 2020."
It wasn't the only ceremony that Obama will be a part of. Earlier on Saturday, Obama shared a message for students at historically black colleges or universities.
At that speech, he took a not-so-veiled shot at his successor's administration, saying, "A lot of them aren't even pretending to be in charge."
"Show Me Your Walk, HBCU Edition" was a two-hour virtual HBCU commencement program presented by Chase in partnership with the Thurgood Marshall College Fund, the United Negro College Fund, the National Association for Equal Opportunity, the NBA, Paul Quinn College, Howard University, ESSENCE and JPMorgan Chase's Advancing Black Pathways Initiative, according to the former president's office.
On June 6, he will be joined by former first lady Michelle Obama in YouTube's "Dear Class of 2020," another livestream event that will honor students. Both Obamas "will deliver separate commencement addresses," according to the office.
That event will feature global leaders, celebrities, creators and more, including Yousafzai, Sundar Pichai, former Defense Secretary Bob Gates, former Secretary of State Condoleezza Rice, Lady Gaga, Alicia Keys and Kerry Washington.
ABC News' Alexandra Svokos and Kelsey Walsh contributed to this report.