In a 6-3 decision by the court’s conservative majority, the justices ruled that requiring people to demonstrate a particular need for carrying a gun in order to get a license to carry one in public violated the Second Amendment right to “keep and bear arms.”