Why this character declaration is suitable in java?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why this character declaration is suitable in java??

char a = 064770

28th Jun 2017, 10:19 AM
Jaina Trivedi
Jaina Trivedi - avatar
1 Answer
+ 12
char a = 064770; is an octal representation of the integer value 27128, which is legal because it fits into an unsigned 16-bit integer. If you try to print out the value of a, the answer will be a "?"
28th Jun 2017, 10:46 AM
Dev
Dev - avatar