Skip to content

Instantly share code, notes, and snippets.

@hakanai
Created March 30, 2011 01:03
Show Gist options
  • Select an option

  • Save hakanai/893674 to your computer and use it in GitHub Desktop.

Select an option

Save hakanai/893674 to your computer and use it in GitHub Desktop.
WHY THE FUCK DOES THIS COMPILE?
public class Overflow
{
public static void main(String[] args)
{
int value = 2000000000;
long increment = 1000000000;
value += increment; // no problemo!
System.out.println(value);
}
}
@hakanai
Copy link
Author

hakanai commented Mar 30, 2011

By the way,

value = value + increment;    // compiler error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment