Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the vector class in java programming?

1076


Can we assign integer value to char in java?

1026


What does snprintf return?

996


What is the difference between int and integer in java?

1021


Is multiple inheritance supported by java?

985


Can we restart a thread already started in java?

1096


What is the purpose of using break in each case of switch statement?

1023


What is private static class in java?

1011


Does java trim remove newline?

980


Why does java not allow multiple public classes in a java file ?

4514


What is supplier in java?

1000


what is recursion in java

1166


what is the major difference between linkedlist and arraylist in java?

1200


What is regex used for?

988


What are identifiers in java?

1109