JAVA How it was true? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
24th Aug 2019, 3:54 PM
Tzion
Tzion - avatar
5 Answers
+ 5
Numeric literals which begin with 0 are octal. The decimal representation of 053 is 43. (8^0 * 3) + (8^1 * 5) = 43
24th Aug 2019, 4:01 PM
Hatsy Rei
Hatsy Rei - avatar
+ 5
Rael , numbers prefixed with 0 are octal system numbers, so when 053 is converted to decimal system it is 43 (3*8^0 + 5*8 ^1 + 0* 8^2 => 43).
24th Aug 2019, 4:03 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 5
From section 3.10.1 of the JLS: An octal numeral consists of an ASCII digit 0 followed by one or more of the ASCII digits 0 through 7 interspersed with underscores, and can represent a positive, zero, or negative integer. https://code.sololearn.com/cBINiU6wOFoT/?ref=app
24th Aug 2019, 4:04 PM
Gordon
Gordon - avatar
+ 3
No, it is just some Mathematics. 053 is not decimal (base 10), because it starts with 0, it is octal (base 8). If you understand binary, for example, 1011(bin) === 1*8 + 0*4 + 1*2 + 1*1 You can understand octal, for example, 0643(oct) === 6*64 + 4*8 + 3*1
25th Aug 2019, 9:54 AM
Gordon
Gordon - avatar
0
Uh it was so complicated for me,does this is compulsory for everyone to know it?
25th Aug 2019, 9:23 AM
Tzion
Tzion - avatar