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 does system out println () do?

1007


What is static class

1120


Difference between predicate, supplier and consumer ?

1064


How to create a fecelet view?

989


Is arraylist ordered?

1082


Can a function return a function?

1044


What do you understand by access specifiers in Java?

1015


when you will synchronize a piece of your code? : Java thread

1030


How static variable work in java?

1130


Can we increase array size dynamically in java?

954


What is stream api in java8?

1188


How will you print number in reverse (descending) order in BST.

982


Can you call one constructor from another if a class has multiple constructors?

1039


What is math in java?

1065


What is a copy constructor in java?

1130