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
Does java have extension methods?
Why we use methods in java?
Is boolean a wrapper class in java?
Which class cannot be a subclass in java?
What is the difference between double and float variables in java?
What is the effect of keeping a constructor private?
Which access specifier can be used with class ?
For class CFoo { }; what default methods will the compiler generate for you>?
Explain about narrowing conversion in java?
What is keyset in java?
Which eclipse is best for java?
What is the base class of all exception classes?
What is a war file?
What is the difference between numeric and integer?
Is java a software?