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
3 Antworten
+ 5
Hello Indian
The code playground doesn't suppprt packages.
Remove "package Collection.com" then it should work.
+ 2
tq Denise Roßberg
i got the output!
+ 2
Indian
Your welcome :)