In java, the compiler throws an error if you try to assign a double literal to an int variable. However, it allows the assignment of an int literal to variable of type long.
double d = 4.0;
float f = d; // this is not allowed. 4.0 should be 4.0f
int i = 4;
long x = i; // this is allowed. 4 is treated same as 4L
intandlongthe wrong way round, meaning you're not doing a fair comparison. If you hadlong i = 4; int x = i;then you'd have the same issue.double d = f;.long x = 4L; int i = x;will not work either