Share on Google+Share on Google+

arraylist size in the Java program

Advertisement
This section demonstrates the How to use of size() function in the java ArrayList.

  • size() function gives  the total number of elements present in
    the arrayList.


Example of Java Arraylist Size() Function
import java.util.ArrayList;
import java.util.List;

public class List1 {
    public static void main(String[] args) {
        float fr[]={33.4f,66.78f,77.8f};
      List list=new ArrayList();
         for (float f:fr) {
         list.add(f);
        }
         for(int x=0;x

	

					






					

Advertisements

Posted on: October 23, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.