“You can’t let them get you down. You can’t let the critics and the naysayers get in the way of your dreams,” he said.
“I guess that’s why I won,” Mr. Trump added.
Mr. Trump, dressed in a dark suit under a baking sun, read his speech from teleprompters, although he occasionally veered off script to extol the virtues of the Coast Guard. At times, he expressed what seemed like wide-eyed wonderment at its exploits on the high seas and the nation’s waterways.
“To secure our borders from drug cartels, human smugglers and terrorist threats, Coast Guard cutters patrol more than 1,500 miles below our southern border,” he said, adding, to the mild bafflement of a friendly crowd, “A lot of people didn’t know that.”
The crowd seemed to approve of the president’s speech, cheering for him and sometimes offering a standing ovation. But in the bus lines in the parking area after the ceremony, some relatives of graduates complained that Mr. Trump had struck a “me note” with his speech.
It was the president’s first public appearance since The New York Times reported on Tuesday that Mr. Comey had written a memo in February in which he said the president had asked him to close an investigation into Michael T. Flynn, who had been pushed out the day before as Mr. Trump’s national security adviser.
Mr. Trump did not wave to reporters as he boarded Air Force One for his flight to Connecticut. But he appeared with a smile and a salute as he walked along a processional to the dais at the Coast Guard Academy’s football field.
Presidents have often used speeches to the nation’s service academies to lay out important foreign policy principles.
In 2002, after the Sept. 11 attacks, President George W. Bush used a commencement speech at the United States Military Academy at West Point to declare his policy of pre-emption, under which the United States pledged to attack any country that posed a critical threat to the American homeland.
In 2014, also at West Point, President Barack Obama told graduating cadets that the United States would rely on local partners to fight…