OnJava8-Examples/operators/Overflow.java
2016-01-25 18:05:55 -08:00

19 lines
505 B
Java

// operators/Overflow.java
// (c)2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Surprise! Java lets you overflow
public class Overflow {
public static void main(String[] args) {
int big = Integer.MAX_VALUE;
System.out.println("big = " + big);
int bigger = big * 4;
System.out.println("bigger = " + bigger);
}
}
/* Output:
big = 2147483647
bigger = -4
*/