« Programmation Java/Transtypage » : différence entre les versions
Contenu supprimé Contenu ajouté
m →Cas des types primitifs : that's not the point. short it is not even guaranteed to be 16 bits long at runtime. Conversion is a matter of the language spec, and will work regardless of the amount of bits chosen by the implementation at runtime. |
|||
Ligne 23 :
int n;
long l = 10L;
n = s; // correct : conversion implicite
n = n + l; // <-- erreur générée, la sous-expression gauche est convertie en long
</source>
|