posted 20 years ago
hi all. just took javarules roundup and....
Question states: Can you automatically/implicitly convert a char to a short?
Answer given is no. They're the same bit-depth but since chars are unsigned, they might have a higher positive value than a short can accept.
Comment: I can automatically / implicitly convert a char to a short if the char variable is declared final and value not more than short's allowable maximum value. The code below when placed in a method and class compiles just fine.
Am i not reading the question right?