Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
考虑代码:
public class Test { public static void main(String[] args) { int i = -0777; System.out.printf("%d",i); } }
该代码产生输出-511,我期望它是-777
-0777带0前缀表示数字是八进制的。
-0777
0
-777八进制是-511十进制。
-777
-511
-0777表示数字是八进制。所以,
-(7*(8^2)+7*(8^1)+7*(8^0))
哪个是-511小数点