Scientists and government officials fighting the coronavirus epidemic say they have a problem: Carefree youths.

As authorities moved to restrict social gatherings last week, bars and restaurants from New York to Berlin filled up with revelers, illegal “lockdown parties” popped up in France and Belgium, and campuses in the U.S. lit up for end-of-the-world dorm parties.

So...