+ 3
How to run this code, does it exist in sololearn?
im getting "can not find symbol" errors for this peice of code, does it work in this app? if so how do i fix it ArrayList<Integer> sample = new ArrayList<Integer>(); sample.add("example");
6 Respostas
+ 13
Yes, it works at the playground.
Make sure you imported it:
import java.util.ArrayList;
+ 10
@Vishal
You're right!
+ 9
@Vishal
I think he didn't, because then it would result in a type error. But both answers combined will make the solution ^^
+ 4
//You are adding ArrayList<Integer> with a String.
//You need to change with the follows :
import java.util.*;
ArrayList<String> sample = new ArrayList<String>();
sample.add("example");
// this will work
+ 2
@Tashi N. I am assuming that he is import the java.util.* library.
+ 2
@Tashi N, looks you are right also. So I had updated the answer.