Let's say I converted double x to an int, which can be done automatically through truncation. Would this be considered implicit conversion still? Is implicit conversion not being able to translate the actual value from one type to another type without losing any accuracy to that value. In this case would I not be losing the decimal part to x's value? I could not find anything specific in the java docs about this, so I thought to ask here:
double x = 420.69;
int y = x;
That is not an implicit conversion and this will result to compiler error.
double x = 420.69;
int y = x;
Since double is a bigger data type than int, it needs to be down-casted.
double x = 420.69;
int y = (int)x;
However,all the digits after the decimal will be lost.