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 / ggpune

Output will be
size :4
Size after: 2

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the need of transient variables in Java ?

1064


Can array grow dynamically in java?

965


Why char array is favored over string for the storage of passwords?

1066


What are some characteristics of interference class?

991


What is java regex?

996


Explain the transient field modifier?

1029


Difference between error and exception

6033


How to sort an array from smallest to largest java?

976


What variables are stored in stack?

956


What is the basic concept of java?

1003


What is an enumeration?

1053


Does substring start with 0?

979


What is polymorphism java example?

1005


What is the similarity between dynamic binding and linking?

1114


What is the generic class?

960