Skip to content

Instantly share code, notes, and snippets.

@ChimeraCoder
Created September 27, 2012 04:41
Show Gist options
  • Save ChimeraCoder/3792197 to your computer and use it in GitHub Desktop.
Save ChimeraCoder/3792197 to your computer and use it in GitHub Desktop.
Java int vs Integer Example
ArrayList<Integer> someNumbers= new ArrayList<Integer>();
ArrayList<int> luckyNumbers= new ArrayList<int>();
//This will cause a compiletime error
//
JavaExample.java:23: unexpected type
found : int
required: reference
ArrayList<int> luckyNumbers= new ArrayList<int>();
^
JavaExample.java:23: unexpected type
found : int
required: reference
ArrayList<int> luckyNumbers= new ArrayList<int>();
^
2 errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment