Java – clarification of “int” numbers starting with 0
•
Java
public class Test {
public class Test {
public static void main(String[] args) {
int i = 012;
System.out.println(i);
}
}
Why is the output: 10?
Solution
If a number starts from 0, it is an octal number with base 8 012 is a decimal 10
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
