0

ArrayList

package Collection.com; import java.util.ArrayList; import java.util.Collections; class cat { public static void main(String[] args) { ArrayList <String> a1=new ArrayList<>(); a1.add("Surya"); a1.add("vijay"); a1.add("Chaitu"); a1.add("NTR"); a1.add("venky"); ArrayList<String>a2=new ArrayList<>(); a2.add("malar"); a2.add("sam"); a2.add("jyo"); a2.add("tapsi"); a2.add("saipallavi"); a2.addAll(a1); Collections.sort(a2); System.out.println(a2); } } Getting output as error Can u plz suggest how to rectify it

10th May 2020, 1:08 PM
Haritha Vuppula
Haritha Vuppula - avatar
3 Respostas
+ 5
Hello Indian The code playground doesn't suppprt packages. Remove "package Collection.com" then it should work.
10th May 2020, 1:14 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
tq Denise Roßberg i got the output!
10th May 2020, 1:22 PM
Haritha Vuppula
Haritha Vuppula - avatar
+ 2
Indian Your welcome :)
10th May 2020, 1:37 PM
Denise Roßberg
Denise Roßberg - avatar