Java int vs Integer Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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