Let $\{x_j\}_{j \in \mathbb{N}} $ be the set of rational numbers in $\mathbb{Q}\cap [0,1]$, and let $f_n(x) = 1_{\{x_j , \ j \leq n\}}$ i.e $f_n$ is $1$ if $x$ lies in the set $\{x_j\}_{0 < j \leq n}$ otherwise.
Why is $\int_0^1 f_n(x) dx = 0$?
Let $\{x_j\}_{j \in \mathbb{N}} $ be the set of rational numbers in $\mathbb{Q}\cap [0,1]$, and let $f_n(x) = 1_{\{x_j , \ j \leq n\}}$ i.e $f_n$ is $1$ if $x$ lies in the set $\{x_j\}_{0 < j \leq n}$ otherwise.
Why is $\int_0^1 f_n(x) dx = 0$?
Given any partition $P$, each subinterval $I$ contains an irrational number where $f_n(x) = 0$. Hence, $\inf_{x \in I} f_n(x) \leqslant 0 \leqslant \sup_{x \in I} f_n(x)$.
Forming the upper and lower sums we have
$$L(P,f_n) \leqslant 0 \leqslant U(P,f_n).$$
Hence, upper and lower integrals satisfy
$$\underline{\int}_0^1 f_n = \sup_{P} L(P, f_n) \leqslant 0 \leqslant \inf_{P} \,U(P,f_n) = \overline{\int}_0^1f_n.$$
Since $f_n$ is continuous almost everywhere it is Riemann integrable and the upper and lower integrals must be equal. Thus,
$$\underline{\int}_0^1 f_n = \overline{\int}_0^1f_n = \int_0^1 f_n = 0.$$