1528 Views
To delete an element, use the remove() method and refer to the index number:
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
ArrayList<String> mobiles = new ArrayList<String>();
mobiles.add("Samsung");
mobiles.add("Apple");
...
Anamika Gupta
Dec 14, 2021