Test Integer overflow - Java Language Basics

Java examples for Language Basics:int

Description

Test Integer overflow

Demo Code

public class Main {
  public static void main(String[] args) {
    int a = 1000000000;
    System.out.println(a);/*from ww  w.j a v a2  s.  co  m*/
    a += 1000000000;
    System.out.println(a);
    a += 1000000000;
    System.out.println(a);
    a += 1000000000;
    System.out.println(a);
  }

}

Related Tutorials