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は、数値が 8 進数であることを意味します。
-0777
0
-7778 進数は-51110 進数です。
-777
-511
-0777数値が 8 進数であることを意味します。そう、
-(7*(8^2)+7*(8^1)+7*(8^0))
インデシマルはどれ-511ですか