undrestanding Maximum principle with example I want to know why if a holomorphic function has local maximum or minimum then it is constant,can someone give an example that why this is true?

The things that I am going to say are based on the understanding of this subject. So they may not reflect the true reason for this fact.

The main reason that this theorem is true is that somehow these functions follow a mean value property that is the Cauchy's integral formula that for a holomorphic function $f$ we have the following property :
$$ f(a) = \frac{1}{2\pi i}\int_{|z-a|=r} \frac{f(z)}{z-a}dz.$$
That is if you know that the average of some quantities attains the maximum value of them
then all of those quantities should be equal.
I state the proof of this theorem below:
Let $f : U \to \Bbb C$ be a analytic function from the connected open subset, $U$, of $\Bbb C$. if for some $a \in U$ we have $|f(a)| \geq |f(z)|$ in some neighborhood of that point. Then $f$ is constant.
proof:  let $C$ be the boundary of a disk centered at $a$ ,subset to $U$, of radius $r$. and suppose $|f(a)|$ is maximum on the this closed disk. Now let $\arg f(z) = \alpha$ then $|f(z)| = e^{-i\alpha}f(z)$ substitute it in the cauchy integral formula , you would get :
$$ |f(a)| = \frac{1}{2\pi i} \int_{|z-a|=r}e^{-i\alpha}\frac{f(z)}{z-a}dz = \frac{1}{2\pi i}\int_{0}^{2\pi} e^{-i\alpha}\frac{f(a+re^{i\theta})}{re^{i\theta}}ire^{i\theta}d\theta\\
 = \frac{1}{2\pi}\int_{C} e^{-i\alpha}f(a+re^{i\theta})d \theta.$$
Thus we have :
$$ \Re|f(a)| = \Re \frac{1}{2\pi}\int_{C} e^{-i\alpha}f(a+re^{i\theta})d\theta = \int_{C}\Re (e^{-i\theta} f(a+re^{i\theta})) d\theta \leq \frac{1}{2\pi}\int_{C} |e^{-i\theta} f(a+re^{i\theta})| d\theta \leq \\ \frac{1}{2\pi}\int_{C}  |f(a+re^{i\theta})| d\theta \leq \frac{1}{2\pi} \int_{C} |f(a)| d\theta = |f(a)| $$
So we must have the equality $|f(a)| = |f(a+re^{i\theta}|$. and for all $z \in C$ we have:
$\Re(e^{-i\theta}f(z)) = |f(z)|=|f(a)|$. So $f(z) = f(a)$ on $C$.
This gives that the function $f$ is constant on an infinite set of numbers with accumulation point. Hence $f$ is constant.
