There is a theorem which says that if a function f is analytic in some domain, then it has a Taylor series that converges to the function in any ball that is contained in the domain. If the only nonzero term in the Taylor series is the constant term then clearly the function has to be constant on the ball. By considering an overlapping set of such balls, you can see that the function must be constant on each connected component of its domain.