SHIMA, Japan -- President Obama says world leaders are "rattled" by Donald Trump -- and have good reason to feel that way.

Mr. Obama was discussing the 2016 presidential campaign during a news conference in Japan, saying foreign leaders are surprised by Trump and not sure how seriously to take the things he says.

"They are rattled by it - and for good reason," Obama said. "Because a lot of the proposals he has made display either ignorance of world affairs, or a cavalier attitude, or an interest in getting tweets and headlines."

Get Breaking News Delivered to Your Inbox

He contrasted that to proposals that thoughtfully address what's required to keep the U.S. safe and prosperous and "to keep the world on an even keel."

The assessment of the presidential campaign came on the sidelines of a Group of Seven advanced economies summit in Japan, the latest world gathering to be colored by global concerns about Trump.

Mr. Obama said many of the likely Republican nominee's proposals display ignorance about world affairs, a cavalier attitude or an interest in getting "tweets and headlines." He contrasted that to proposals to make America safe.

Questions about the unpredictable Trump have increasingly trailed Obama when he travels overseas, with world leaders incredulously sizing up a leading presidential candidate who speaks of banning Muslim immigration, starting trade wars and spreading nuclear weapons to Japan and South Korea. Obama has said that Trump now comes up in every one of his foreign meetings, with the president offering reassurances that he doesn't believe Trump will be elected.

Though Obama has generally avoided opining on the presidential race, particularly while the Democratic primary continues to play out, he's made no secret of his distaste for Trump, whose election would mark a sharp departure from Obama in both tone and substance. In addition to opposing the sweeping Asia-Pacific free trade deal that Obama brokered, Trump has threatened to renegotiate Obama's nuclear deal with Iran and the global climate pact reached in Paris.

The president also downplayed Democratic concerns about the long-running primary fight between Hillary Clinton and Bernie Sanders. He said sometimes in a primary, people get "grumpy." But Mr. Obama said the difference between Democrats and Republicans this year is the Democratic candidates aren't that ideologically different from one another.

He urged both Democratic candidates to "try to stick to the issues," adding that the grumpiness often stems from voters' frustration when the campaign instead becomes dominated by talk about "personalities and character."

Mr. Obama explained that "during the course of a primary, people say what they think might help them get some votes." But once the campaign is over, the candidates "move on" and try to reconcile their party vision.

As far as hurting the Democratic party's chances at beating Trump in November, the president predicted the ongoing nomination fight will do little to hinder their prospects.

"The one thing I've learned after being around for a while is that kind of day-to-day choppiness is not indicative of longer trends," Mr. Obama said. "I feel confident about the Democratic vision for the country."

He added: "Would it be nice if everybody was immediately unified and singing kumbaya and whoever the nominee ended up being could just take a nice two-week vacation to re-charge? Absolutely. I guarantee you that the eventual nominee sure wishes it was over now. Because this is a grind. It's hard."

Asked about the Taliban's new leader, Obama said he was not optimistic about a change for the better any time soon despite the U.S. drone strike that killed former Taliban chief Mullah Akhtar Mansour, who had refused to engage in reconciliation talks with Afghanistan's government.

Mansour's replacement, Mullah Haibatullah Akhundzada, has signaled intentions to continue Mansour's aggressive approach. But Obama said he never expected "a liberal Democrat" to be the newly appointed leader of the Taliban.

"In the short term, we anticipate the Taliban will continue to pursue an agenda of violence," Obama said. He added that he was hopeful that eventually "when there are those within the community that surround the Taliban that recognize their goals are best achieved by negotiations."

At the summit, the world leaders expressed concern about emerging economies "as their host, Japanese Prime Minister Shinzo Abe, made a pointed comparison to the 2008 global financial crisis -- but not all his G7 partners appeared to agree," the Reuters news service reported.

"The G7 leaders did agree on the need for flexible spending to spur world growth but the timing and amount depended on each country, Deputy Chief Cabinet Secretary Hiroshige Seko told reporters, adding some countries saw no need for such spending," Reuters continued. "Britain and Germany have been resisting calls for fiscal stimulus."