Answers for "get length of list java"

0

how to get a list length in java

import java.util.ArrayList;
import java.util.List;
public class Demo {
   public static void main(String[] args) {
      List aList = new ArrayList();
      aList.add("Apple");
      aList.add("Mango");
      aList.add("Guava");
      aList.add("Orange");
      aList.add("Peach");
      System.out.println("The size of the ArrayList is: " + aList.size());
   }
}
Posted by: Guest on September-13-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language