+ 27
Must know for every programmer. Check you may or may not know this.
In Java,C/C++, Perl, PHP, Javascript, Ruby, Python ... int x = 010; This assigns x to have the value 8. Any integer preceded with a zero in these languages is presumed octal.
6 Respuestas
+ 4
@Raj Kumar Chauhan:
Seems showing toking error in Python 3.x, but is 8 in Python 2.x ^^
+ 2
x=010
print (x)
shows token error in python
+ 2
in python Capital O in front of the number generates defines octal. 0(zero) causes token error.
+ 1
潘朵拉
+ 1
In java
int x=012
//output is 10 converted to octal
0
So basically
Int x = 017;
x would be 16.