Answers for "arraylist empty java"

0

java create empty arraylist

ArrayList<Class> myList = new ArrayList<Class>();
Posted by: Guest on March-12-2021
0

ArrayList isEmpty() method in java

import java.util.ArrayList;
public class ArrayListIsEmptyMethodExample
{
   public static void main(String[] args)
   {
      ArrayList<Integer> al = new ArrayList<Integer>();
      // before checking ArrayList using isEmpty() method
      System.out.println("Is ArrayList empty: " + al.isEmpty());
      al.add(86);
      al.add(25);
      al.add(53);
      al.add(85);
      // after checking ArrayList using isEmpty() method
      System.out.println("Is ArrayList empty: " + al.isEmpty());
      for(Integer num : al)
      {
         System.out.println(num);
      }
   }
}
Posted by: Guest on October-29-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language