
I found a proof of showing, given that $D$ is compact, if the function $f$ is upper semicontinuous then f achieves a maximum on $D$. But I have a question about the very last sentence:
and thus $M<\infty$.
How could this conclusion is obtained, since just before two lines it is said that "It may be that $M=\infty$"?
Could anyone help me with this? Thanks!