CDF of a random variable $X$ is given by table:
| $x < 1$ | $1 \leq x < 2$ | $ 2 \leq x < 3$ | $3 \leq x < 4 $ | $4 \leq x$ |
|---|---|---|---|---|
| $0$ | $0.2$ | $0.35$ | $0.9$ | $1$ |
Find $E(X)$.
\begin{align*} E(X) &=\int_{-\infty}^{\infty} x f(x) \, dx \\ &=\int_{-\infty}^{0} (x\cdot 0) \, dx + \int_{1}^{2} (x \cdot 0.2) \, dx + \int_{2}^{3} (x \cdot 0.35) \, dx + \int_{3}^{4} (x \cdot 0.9) \, dx + \int_{4}^{\infty} (x\cdot 1) \, dx \\ &= 0+0.3+0.875+3.15 \\ &=4.325 \end{align*}
Why is my answer not correct?
You are given the CDF, not the pdf nor pmf.
The CDF functions jumps at certain values and remains constant otherwise. This is a behavior of a discrete random variable.
We can recover the probability as follows:
$$P(X=1)=P(1 \le X<2)-P(X<1)=0.2-0=0.2$$
Note that the probability doesn't increase over $1<X<2$, the random variable take those values with probability $0$.
After recovering the probability (pmf), you can compute the expected value by $$\sum_{i=1}^4 i P(X=i)$$
Alternatively, use $$E[X]=\int_0^\infty (1-F(X))\, dx$$
to compute the expected value.