Let $X$ be a continuous random variable with support $\mathcal{X}$ and density $f(x)$. Suppose I'm interested in constructing a consistent estimator of $E(X)$ using $n$ i.i.d. observations $(X_1,..., X_i, ...,X_n)$ with $X_i\sim X$.
As a first simple thought, I would consider $$ \hat{\mu}_n=\frac{1}{n} \sum_{i=1}^n X_i $$ which is a consistent estimator of $E(X)$ as $n$ goes to infinity, under some conditions.
Suppose I want to complicate my life and take the definition of $E(X)$ which is $$ E(X)=\int_{x\in \mathcal{X}} x f(x)dx $$ At this point, I could consider a kernel estimator for $f(x)$ (let me denote it by $\hat{f}_n(x)$) which is consistent for $f(x)$ under certain assumptions. In turn, I could compute $$ \tilde{\mu}_n=\int_{x\in \mathcal{X}} x \hat{f}_n(x)dx $$ which is a consistent estimator of $E(X)$ as $n$ goes to infinity, under some conditions.
If the above is correct, it seems to me that $\hat{\mu}_n$ and $\tilde{\mu}_n$ achieve the same objective, although under different (more or less stringent) set of conditions. Is this true?