In general $ E[X] = \int x f(x)dx $ where $x$ is the variable's value itself and $f(x)$ is the pdf.
Here the main initial difficulty (for me atleast) was wrapping my head around the notation.
Essentially $f(x)$ is our random variable, with $p(x)$ as its pdf and the domain of $p(x)$ as its domain.
Therefore
$ E [X] = \int_0^a f(x) p(x)dx $
$ = \int_0^a x^2 \frac{1}{a}dx $
$= [^a_0 \frac{x^3}{3} \times \frac{1}{a} $
$= \frac{a^3}{3a} - \frac{0^3}{3a} $
$\large = \frac {a^2}{3}$