Convexity properties of solutions to some classical variational problems