4 Answers
New AnswerYou 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?
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message