What will be the output of the program?
public class Test {
public static void main(String args[]) {
ArrayList<String> list = new ArrayList<String>();
list.add("2");
list.add("3");
list.add("4");
list.add("5");
System.out.println("size :"+list.size());
for(int i=0;i<list.size();i++) {
list.remove(i);
}
System.out.println("size after:"+list.size());
}
}
Answer Posted / vanjinathan
How it comes 2 after removing the list elements.??
please explain..??
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Can we use return in constructor?
Which is best ide for java?
How is it possible for two string objects with identical values not to be equal under the == operator?
Is a method a procedure?
Explain the difference between abstract class and interface in java?
When should I use singleton?
List some important features of java 10 release?
What is java developer skills?
What do you understand by the term singleton?
Is it possible to write a regular expression to check if string is a number?
What are the benefits of immutable objects?
Which is bigger float or double java?
What are the four versions of java?
Difference between current previous versions of Java?
Define the term string pool?