Comparing definitions of independence of two random variables Edit: As pointed out in the answer of Andre Nicolas, what I call definition A below of "independent" is really that of what is called "uncorrelated" random variables. So the title now is a bit misleading; however I'll leave it as is.
There are two definitions of random variables $X,Y$ being "independent". One ("definition A") is via the expected value equation $E(XY)=E(X)E(Y),$ and this seems motivated in that when it holds the covariance of $X,Y$ is zero. 
Another ("definition B") is in terms of the joint density function $f(x,y)$ of the two variables $X,Y,$ which for indepencence must be such that it is nonzero over a region $I \times J$ (for simplicity assume $I,J$ are intervals) and in that region $f(x,y)=g(x)h(y)$ where $g,h$ are the two "marginals" for $X,Y$ respectively.
It seems simple to show that if the variables satisfy definition B then they also satisfy definition A. What I don't know (and would like to) is whether, assuming only that $X,Y$ satisfy definition A, does it follow they also satisfy definition B?
My guess is no, since definition A seems so much weaker than definition B, the latter requiring a product condition at each point $(x,y)$ and the former only an equality of certain sums or integrals. 
I tried for a simple discrete example for $X,Y$ each taking on a few possible values. In the 2 by 2 case the requirement led to equality between either the two values assumed by $X$ or by $Y$ (so not an example). And the continuous version seems more difficult to formulate (to me). So if anyone already has an example (discrete or continuous) I'd appreciate hearing it, or on the other hand if it is known definition A implies definition B, a sketch or reference.

For a discrete example, let $X$ be equal to $-1$, $0$, or $1$, each with probability $\frac{1}{3}$, and let $Y=X^2$. Then $X$ and $Y$ are not independent, but $E(XY)=E(X)E(Y)$. 
For continuous, let $X$ be standard normal, or uniform on $[-1,1]$, and let $Y=X^2$.
When $E(XY)=E(X)E(Y)$, the random variables $X$ and $Y$ are said to be uncorrelated.
