int num = 000111;
System.out.println(num);
The output is 73.
Why is this happening?
How can I make the output to be 111? Or, How can I make the value to become 111.
A leading 0 means the value is expressed in octal notation. To make it 111 dont use leading zeroes.
The leading zero causes the integer literal to be interpreted as octal value. 111oct = 73dec
You should remove the leading zeros.