Consider the below code
public class LongPuzzle
public static void main(String args)
int a = 0123;
int b = 3210;
What is the result?
Have you answered 4444? No surprise, I've expected that you would answer 4444. But when you run the above program, you would get 3293Why 3293?
The value 0123 has been assigned to variable a. In Java, prefixing 0 for a decimal number would be treated as an octal representation. So, 83 is the equivalent decimal number for octal representation 123. 83+3210 = 3293.
Be careful in prefixing the leading 0 in front of decimal numbers.
I'm very excited and thrilled to learn things like this. - Don't you?