Instantly share code, notes, and snippets.

Embed
What would you like to do?
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