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 / surendrababu koppula

ArrayList class remove method example.remove(int index) Removes the element at the specified position in this list. Shifts any subsequent elements to the left.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a static method in java?

1043


What is a default constraint?

1065


What are data structures in java?

968


What are some characteristics of interference class?

993


How a string is stored in memory?

1005


What are the problems faced by java programmers who don't use layout managers?

965


What is preparedstatement in java?

1037


I want my class to be developed in such a way that no other class (even derived class) can create its objects. How can I do so?

976


What is set in java?

1034


What is a lightweight component?

1019


What is integer parseint?

985


What is hasnext in java?

1009


Explain the meaning of java applet.

1064


How do you break a loop?

977


Explain reverse a linked list iterative solution in java?

918