The problem is that, Assume U is connected, use the maximum principle to show that the only smooth solutions of $-\Delta u=0$ in U and $\frac{\partial u}{\partial \nu}=0$ on $\partial U$ are $ u \equiv C $ for some constant C.
I know that u attains max and min on $\partial U$, I wonder if u is constant on $\partial U$, can we prove this?
Thanks for your help in advance!
I am not sure how to do this with the maximum principle, but I can give a short proof with integration by parts. On the one hand
$$-\int_U u \Delta u dx = 0$$
On the other hand
$$-\int_U u \Delta u dx = \int_U |\nabla u|^2 dx - \int_{\partial U} u \frac{du}{d \nu} dS = \int_U |\nabla u|^2 dx.$$
Hence $\nabla u = 0$ and $u \equiv C$.
Perhaps you can adapt this proof?