Can someone explain the underlying mechanics behind this chunk of code.
System.out.println(0x10);
Can someone explain the underlying mechanics behind this chunk of code.
System.out.println(0x10);
0x or 0X in front of the numbers are hex format.
Why 16:
0x1 0
1 * 16^1 + 0 * 16^0
= 1 * 16 + 0 * 1
= 16 + 0
= 16
The 0x
indicates the compiler that the following literals are supposed to be a hex number witch in your example is 10 hex or 16 decimal