arraylist size in the Java program


 

arraylist size in the Java program

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

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

	


          








					






       











		

Ads