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 use of :: in java?

1074


What is array initialization in java?

1175


Can we define a package statement after the import statement in java?

1115


Does the order of public and static declaration matter in main method?

1111


Is set sorted in java?

991


How to restrict a member of a class from inheriting by its sub classes?

1388


What is vector capacity in java?

1144


How we can declare a static variable?

1148


What is arguments in java?

1054


Can list be final in java?

983


What do you mean by thread safe?

1024


Can we instantiate interface in java?

1184


Write a program to search a number in the given list of numbers.

1076


What is class??

1294


Is hashset ordered java?

1151