+ 1
What will be the output and why?
public static void main(String args[]) { int x=033; System.out.println(x); }
1 Answer
+ 3
You can test-run the code in Playground for getting the output.
As for why; if an integral value be prefixed by a zero, it is assumed an octal value (base 8) instead of a decimal (base 10).
https://en.m.wikipedia.org/wiki/Numeral_system
33 in octal equals to 27 in decimal.