0
What will be the output of this code?
ArrayList arr=new ArrayList(9); arr.add("css"); arr.add("java"); arr.add("kotlin"); System.out.print(arr.size());
5 Answers
+ 1
import java.util.*;
public class Program
{
public static void main(String[] args) {
ArrayList arr=new ArrayList(9);
arr.add("css");
arr.add("java");
arr.add("kotlin");
System.out.print(arr.size());
}
}
check in playground
+ 5
Answer will be 3, because you have used ArrayList#add(<T>) method 3 times, in this case initialisation doesn't matter.
+ 3
Prokopios Poulimenos I did but forgot importing util đ
đ
+ 2
3 I guess. Just copy the code into the code playground and find out yourself.
+ 1
Zlytherin thanks



