Example 2 (2003 Beijing Competition Question) $[a]$ represents the greatest integer not exceeding $a$, then the maximum value of the function $y=x-\pi-\left[\frac{x}{\pi}\right]-|\sin x|$ is ( ).
A. $-\frac{\sqrt{2}}{2}$
B. $\frac{1}{2}$
C. 1
D. Does not exist
Solution: Choose D. Reason:
Since $0 \leqslant \frac{x}{\pi}-\left[\frac{x}{\pi}\right] \leqslant 1,0 \leqslant|\sin x| \leqslant 1$,
$$
y=\frac{x}{\pi}-\left[\frac{x}{\pi}\right]-|\sin x| \leqslant 1-0=1,
$$

Therefore, the maximum value of $y=\frac{x}{\pi}-|\sin x|$ could be 1.
Next, we show that it cannot reach 1.
Since $y$ is a periodic function with a period of $\pi$, we only need to consider the changes of the function when $x \in(0, \pi)$. On $x \in(0, \pi]$, when $x \in(0, \pi)$, $\left[\frac{x}{\pi}\right]=0, \sin x>0$, then $y=\frac{x}{\pi}-\sin x$, and $\frac{x}{\pi}$ is monotonically increasing, $\sin x$ is monotonically decreasing, so $y=\frac{x}{\pi}-\sin x$ is monotonically increasing; when $x=\pi$, $y=0$. Therefore, $y$ has no maximum value.