Java Reference
In-Depth Information
}
Note that we initialized the long variable m by appending a ā€œLā€ to the long
digit to tell the compiler that this is a natural number using double precision.
Otherwise, the compiler would have complained that our integer ( int ) was too
big. Now, compile and execute this basic code to see the incoherent results:
prompt%java OverflowBug
If n=2147483647 then n+1=-2147483648
If m=9223372036854775807 then m+1=-9223372036854775808
One gets negative numbers, quite an unexpected result, isn't it? Loosely
speaking, what happened is that the incrementation generated a carry that
was propagated to the sign bit of the number type (the 32th and 64th bit
respectively). These numbers were then decoded as negative numbers.
1.10 Integrated development environments
(IDEs)
Figure 1.2 Snapshot of the JCreator integrated development environment
Once you get used to programming basic java programs, it will become more
and more cumbersome to type the various compiler/execution commands. Even
simple programs with small mistyped characters may generate long lists of
 
Search WWH ::




Custom Search