Without mentioning presumptive Republican nominee Donald Trump by name, U.S. President Barack Obama Sunday decried the “ignorance” pervading American politics in a commencement address at Rutgers University in New Brunswick, New Jersey.

“In politics and in life, ignorance is not a virtue,” Obama said, saying he wanted to be as clear as possible. “It’s not cool to not know what you're talking about. That’s not keeping it real or telling it like it is. That’s not challenging political correctness; that’s just not knowing what you’re talking about. And yet we’ve become confused about this.”

Obama said keeping the rest of the world at bay won’t fix the nation’s problems — likely a reference to Trump’s pledge to build a wall along the border with Mexico and his suggestion that the U.S. bar Muslim immigration to the country.

“Isolating or disparaging Muslims, suggesting they should be treated differently when entering this country — that is not just a betrayal of our values, that’s not just a betrayal of who we are. It would alienate the very communities at home and abroad that are our most important partners in the fight against violent extremism,” he said.

Isolationism is not the answer, Obama said.

“The world is more interconnected than ever before, and it’s becoming more connected every day,” Obama said. “Building walls won’t change that.”

Trump has been highly critical of recent trade agreements and has called for ending trade with certain countries. Obama said Trump’s view is too simplistic.

“In this global economy, that isn’t even possible,” he said. “The answer is to do trade the right way.”