Skip to content

Instantly share code, notes, and snippets.

@josephkandi
Created May 5, 2016 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephkandi/93e2f92482a46c88f41cde2a3297ef7f to your computer and use it in GitHub Desktop.
Save josephkandi/93e2f92482a46c88f41cde2a3297ef7f to your computer and use it in GitHub Desktop.
class IntDemo {
public static void main (String[] args) {
////The int type stores values in the range -2147483648 to 2147483647
//The Java compiler is optimized to use the int type
//Choose int type when you need a number without a decimal place as your default
int currentUsersOnline = 2147483647;
System.out.println("currentUsersOnline " + currentUsersOnline);
//TODO
//Try changing the value of currentUsersOnline to 2147483648
//Notice we can't hold it any longer in the int type
//This is the case when you will need to use long type
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment