how to remove a number from array list in java code example
Example 1: remove item from arraylist in java
List<Integer> al = new ArrayList<>();
al.add(10);
al.add(18);
al.remove(1);
Example 2: how to remove an element from an arraylist java
import java.util.List;
import java.util.ArrayList;
public class GFG
{
public static void main(String[] args)
{
List<Integer> al = new ArrayList<>();
al.add(10);
al.add(30);
al.add(1);
al.add(2);
al.remove(1);
al.remove(1);
System.out.println("Modified ArrayList : " + al);
}
}