ArrayList cannot find symbol | Sololearn: Learn to code for FREE!


ArrayList cannot find symbol

I'm looking at this code and can't see where I made a mistake. edit:changed the code and it works!

5/18/2018 10:16:14 PM


4 Answers

New Answer


You need imports at the top import java.util.ArrayList; import java.util.Collections;


Cool, I didn't even realize you could run java code in the playground, learned something new today. I tried it with the imports and it worked, nice. import java.util.ArrayList; import java.util.Collections; public class Program { public static void main(String[] args) { ArrayList<Integer> list = new ArrayList<Integer>(); list.add(4); list.add(2); list.add(3); list.remove(2); Collections.sort(list); System.out.println(list.get(0)*list.size()); } }


I could be wrong, but I didn't think you could run java code in the Sololearn playground. Thought it was limited to HTML, CSS and Javascript. Have you tried testing in Eclipse or Netbeans?


Start the code and see. I'm full of doubts.