JAVA. On which of this three lines compilation fails? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

JAVA. On which of this three lines compilation fails?

Please, help! On which line compilation will give an error if at all: ArrayList<Integer> counts = new ArrayList<>(); - Not this one 100% counts.add(10); counts.add(new Integer(8)); Any help is much appreciated!

12th Jun 2018, 5:56 AM
DIY Mods
DIY Mods - avatar
1 Antwort
+ 1
Just put it into code playground and run it:) I already did that for you. If you imported java.util.ArrayList, then it should do fine: https://code.sololearn.com/c2LV6shnrfg8/?ref=app
12th Jun 2018, 6:33 AM
Jonas Schröter
Jonas Schröter - avatar