why is this array to 2d array boolean true?

arrays, boolean, java, syntax

Solution

This happens because `053` is an octal number equal to `43` in decimal.

The `0` prefix denotes an octal value in Java and some other languages (Perl, Ruby, C and derived, Javascript to name a few).

Problem

Hi I happen to come across a code that my friend sent me, and am having trouble making out the second part of the print statement.. `a[3]` is 4, which is in row 0 column 2 (`b[0][2]`), but why is `a[2]` which is 53, proving true to `b[2][1] == 43` ??? (The code prints 'true true' btw.) ``` class Ex1{ public static void main(String[] args) { int a[] = { 1,2,053,4}; int b[][] = { {1,2,4} , {2,2,1},{0,43,2}}; System.out.print(a[3]==b[0][2] ); System.out.print(" " + (a[2]==b[2][1])); } } ```

Original source