java convert float to double 1

java convert float to double

float myFloat = x; //your float
double d = (double)myFloat;

Here is what the above code is Doing:
1. We create a float variable called myFloat and assign it the value of x.
2. We create a double variable called d and assign it the value of myFloat.
3. We cast myFloat to a double.

Similar Posts