Comedian Jerry Seinfeld mocked Harvard University during a commencement speech at Duke University on Sunday after several anti-Israel students walked out of the ceremony when he was introduced. 

"I’m not talking about Harvard now. I’m talking about the way it used to be. You’re never going to believe this, Harvard used to be a great place to go to school. Now it's Duke," he said, noting he had a lot of Harvard graduates on his staff in the 90s who were embarrassed about attending the Ivy League school. 

Some students chanted "free Palestine" while leaving the ceremony after Seinfeld, a vocal supporter of Israel, was introduced. Anti-Israel students have set up encampments at colleges across the U.S., including at Harvard University, to protest the schools' investments in Israel and the Israel-Hamas war.

Seinfeld didn't address the protesters in his speech and focused on his message to Duke's graduates.

Jerry Seinfeld

Jerry Seinfeld, the writer/director/star of "Unfrosted," poses at the premiere of the Netflix film at the Egyptian Theatre, April 30, 2024, in Los Angeles. (AP Photo/Chris Pizzello)

LIVE UPDATES: ANTI-ISRAEL PROTESTERS DISRUPT COLLEGE COMMENCEMENT CEREMONIES AS CAMPUS DEMONSTRATIONS CONTINUE

Seinfeld spoke to the graduates about his "three real keys to life," which he said were, "bust your a--," pay attention and fall in love. 

"Whatever you're doing, I don't care if it's your job, your hobby, a relationship, getting a reservation at M Sushi," the comedian said. "Make an effort. Just pure, stupid, no-real-idea-what-I'm-doing-here effort. Effort always yields a positive value, even if the outcome of the effort is absolute failure of the desired result. This is a rule of life. Just swing the bat and pray is not a bad approach to a lot of things."

He told the graduates to fall in love with everything they do, not just in their relationships. 

"Fall in love with your coffee. Your sneakers. Your Blue Zone parking space. I've had a lot of fun in life falling in love with stupid, meaningless physical objects," Seinfeld said. "I have truly spent my life focusing on the smallest things imaginable, completely oblivious to all the big issues of living."

Jerry Seinfeld

Jerry Seinfeld on "Today" on April 24, 2024. (Nathan Congleton/NBC via Getty Images)

CLICK HERE FOR MORE COVERAGE OF MEDIA AND CULTURE

Seinfeld visited Israel in December and reportedly had an "emotional" meeting with the freed hostages and representatives of families whose loved ones are still held captive in Gaza, according to Israeli news outlet Haaretz.

"Well, I’m Jewish," the comedian said of his reason for visiting Israel during an interview with GQ Magazine. "And you grow up learning about antisemitism, but it’s kind of in a book. It never crossed my mind that people would look at me as anything other than, ‘I like this comedian. I don’t like this comedian.’ I think most Jews of my generation never thought about antisemitism. It was from history books. And then it was something different. It was something different."

Jerry Seinfeld and his wife Jessica Seinfeld at the Met Gala 2024 red carpet in a black suit and black and white dress.

Jerry Seinfeld and his wife Jessica Seinfeld at the Met Gala 2024 red carpet in a black suit and black and white dress. (Getty Images)

CLICK HERE TO GET THE FOX NEWS APP

Fox News' Jeffrey Clark contributed to this report.