You can implicitly convert an int to a double: double x = 5;
double x = 5;
You can explicitly convert an int to a double: double x = (double) 5;
double x = (double) 5;
The range of double is wider than int. That's why you need explicit cast. Because of the same reason you can't implicitly cast from long to int:
double
int
long
long l = 234; int x = l; // error