Let $x$ have a uniform density
$f_x(x\mid\theta) \sim U(0,\theta)=\left\{ \begin{array}{ll} \frac{1}{\theta} & 0 \leq x \leq \theta \\ 0 & \text{otherwise} \end{array} \right.$
If there are $n$ samples $D=\{x_1,x_2,...,x_n\}$ drawn independently according to $f_x(x\mid\theta)$; then:
How can I show that the maximum likelihood of $\theta$ is $\max[D]$?
The MLE is the maximum $W$ of the sample $X_i, X_2, \dots, X_n,$ as illustrated in the figure below. This MLE cannot be found by differentiation because the likelihood function is discontinuous at its maximum.
The true parameter value is $\theta = 7.$ The likelihood function for a particular sample of size $n=10$ is shown in the interval $(2, 15).$ The largest value in the sample is $W = 6.926851.$
You should formulate a mathematical argument that describes what you see in the figure.
Note: Obviously, the MLE is biased. The maximum $W$ of the data can never exceed $\theta.$ But $E\left(\frac{n+1}{n}W\right) = \theta.$