I want to calculate the following probability of two random variables (we don't know if they are independant) $P(X<Y)$.
In the case they are discrete it is easy: $P(X<Y)=\sum_{-k=\infty}^{+\infty}P(X < Y \cap Y=k)=\sum_{-k=\infty}^{+\infty}\sum_{j=-\infty }^kP(X=j\cap Y=k)$
The question is the following: What is $P(X<Y)$ in the case of $X,Y$ being continuous ? The intuitive answer would be to replace $P(X=j\cap Y=k)$ with the joint density function $f_{X,Y}$ and so to have $\int_{-\infty}^{\infty}\int_{-\infty}^{y}f_{X,Y}(x,y)dxdy$
Is this correct or is there a mistake somewhere?
If $X$ and $Y$ have joint density $f(x,y)$, then for any Borel subset $D\subset{\bf R}^2$, one has $$ P((X,Y)\in D) = \iint_{D}f(x,y)\,dxdy. $$
In your example, you have $D = \{(x,y)\in{\bf R}^2\mid x<y\}$. By the Fubini theorem, $$ P(X<Y) = \iint_{\{x<y\}}f(x,y)\,dxdy = \int_{-\infty}^{\infty}\int_{-\infty}^yf(x,y)\,dxdy. $$
So the integral you have is correct.