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

0

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! https://code.sololearn.com/cNTv5IMha03I/?ref=app

5/18/2018 10:16:14 PM

noa

4 Answers

New Answer

+10

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

+1

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()); } }

0

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?

0

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