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

Does java have extension methods?

921


Why we use methods in java?

943


Is boolean a wrapper class in java?

1015


Which class cannot be a subclass in java?

968


What is the difference between double and float variables in java?

1098


What is the effect of keeping a constructor private?

889


Which access specifier can be used with class ?

960


For class CFoo { }; what default methods will the compiler generate for you>?

1035


Explain about narrowing conversion in java?

970


What is keyset in java?

1026


Which eclipse is best for java?

962


What is the base class of all exception classes?

1033


What is a war file?

1021


What is the difference between numeric and integer?

962


Is java a software?

905