how To Remove Element of arraylist

There we will remove one element of arraylist using remove().

import java.util.ArrayList;

public class RemoveElement {

public static void main(String[] args) {

ArrayList<String> arr = new ArrayList<String>();

// add element in arraylist

// print arraylist
System.out.println(“Before Remove Element ArrayList is = ” + arr);

* Removes the element at the specified position in this
list. Shifts any subsequent elements to the left


System.out.println(“After Remove Element ArrayList is=”+arr);



Before Remove Element ArrayList is = [c, php, html, java]

After Remove Element ArrayList is=[c, html, java]

Related Posts: 

Notice: compact(): Undefined variable: limits in /home/javaprof/public_html/wp-includes/class-wp-comment-query.php on line 853

Notice: compact(): Undefined variable: groupby in /home/javaprof/public_html/wp-includes/class-wp-comment-query.php on line 853

Leave a Reply

Your email address will not be published. Required fields are marked *

− 1 = 1