int i=99 is working however int i = 099 not working
int, java, runtime-error, runtimeexception
Solution
Any leading `0`s will make Java interprets the number as octal number. So, `010` is actually `8`.
System.out.println(010);
OUTPUT:
8
And as you know, `8` and `9` are not allowed in an octal number.
Problem
In Java, I noticed that when I write ``` int i = 99; ``` it works fine. However when I say ``` int i = 099; ``` I get an exception: ``` java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: <any> ``` In my IDE, I see a red dot saying `integer number too large: 099`. Why this is not getting compiled? Isn't 099 is equivalent to 99?