Language:

Search

How to Remove item from array list in Java?

  • Share this:
post-title
post-title

Using al.remove() as shown below

import java.util.ArrayList;
import java.util.List;
public class ArrayListRemoveObjectMethod
{
   public static void main(String[] args)
   {
      List<Integer> al = new ArrayList<>();
      al.add(24);
      al.add(35);
      al.add(12);
      al.remove(new Integer(35));
      al.remove(new Integer(12));
   }
}
Ammar Javed

Ammar Javed

Still Learning | Still Searching | Still Exploring | The secret of your success is determined by your daily agenda.