+ 2

Is there a way to get wrapper classes in soloLearn

I'm asking this because when I try to make an Interger object it doesn't make one in the soloLearn ide, if not is there a way for me to make an arraylist of primitive objects in soloLearns ide in Java?

11th Sep 2019, 1:13 AM
Stuart Moss
Stuart Moss - avatar
7 Respuestas
+ 1
// Interger x = 5; //typo Inte(r)ger Integer x = 5;
11th Sep 2019, 6:58 AM
zemiak
0
ArrayList can't stores primitive int, but it can automatically convert int to Integer object as element. Integer stores one primitive int. ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(0,1,2,3,4,5)); list1.add(100); System.out.println( list1 ); 3th party libraries can store primitive int similar way
11th Sep 2019, 6:38 AM
zemiak
0
zemiak I know that but try making an Interger object in soloLearn it doesn't have it in the java library
11th Sep 2019, 6:46 AM
Stuart Moss
Stuart Moss - avatar
0
Integer oi =100; // this ?
11th Sep 2019, 6:53 AM
zemiak
0
zemiak Yeah it works in all ides but soloLearn must not have the entire java library because it outputs errors https://code.sololearn.com/c3clzjW2rT9d/?ref=app
11th Sep 2019, 6:55 AM
Stuart Moss
Stuart Moss - avatar
0
zemiak that is embarrassing, thanks
11th Sep 2019, 7:09 AM
Stuart Moss
Stuart Moss - avatar
0
:-D
11th Sep 2019, 7:14 AM
zemiak