“I kept up with Ashley but didn’t want to commit,” said Mr. Sands, adding that he was aware that she was eager for the relationship to take the next step.

After a few weeks of studying together and hanging out in Annapolis, it didn’t take long for Mr. Sands to change his mind. On Sept. 13, 2013, as they walked along the Chesapeake Bay, he asked for exclusivity. “I could see we were able to take the fun we had in San Diego and carry it to the academy,” Mr. Sands said. “We fell in love early as she pushed me to be a better person.”

Yet having a romantic relationship at a military academy was a challenge.

After their plebe year, midshipmen are allowed to date as long as they are in different companies. (He was in the 27th; she was in the 11th.) “You can’t show any affection while in uniform or on the academy yard, ” Mr. Sands said. “But when we wore civilian clothes, I was allowed to kiss her and hold her hand in public.”

When they wanted to be together on weekdays, they could go to the other’s room to do homework, watch TV or listen to music as long as the door remained open. “It was not unusual to be a couple at the academy, and we socialized with others,” Ms. Iorio said. “But we had to work hard to carve out time for each other because of our grueling schedules.”