An explicit conversion is where you use some kind of syntax to tell the program to do the conversion. For example (in Java):
int i = 999999999; byte b = (byte) i;
Implicit conversion is where the conversion occurs without any syntax. For example (in Java):
int i = 999999999; float f = i;
It should be noted that (in Java) transformations involving primitive types usually involve some change in presentation, and this can lead to loss of accuracy or loss of information. Conversely, transformations that include reference types (only) do not change the fundamental idea.
Difference is different in Java and C ++?
I can’t imagine it. Obviously, the available conversions will be different, but the difference between “implicit” and “explicit” will be the same. (Note: I am not an expert in C ++ ... but these words have a natural meaning in English, and I cannot imagine that the C ++ specifications use them in a contradictory sense.)
Stephen c
source share