Java (remove)

【remove】 This method is used to delete the elements of ArrayList. Specify the index of the element you want to delete and use it as shown below. Variable name.remove (index)

In the ArrayList "array" used in Java (add) times Remove the element at the location specified by the remove method.

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

array.add ("Japanese"); array.add ("English"); array.add ("French"); array.add ("Chinese"); array.add ("German");

System.out.println(array);

[Japanese, English, French, Chinese, German]

Delete "French" in index 2.

array.remove(2);
System.out.println(array);

The output in the list is as follows.

[Japanese, English, Chinese, German]

The value of the specified element is deleted.

Recommended Posts

Java (remove)
Java
Java learning (0)
Studying Java ―― 3
[Java] array
Java protected
[Java] Annotation
Java array
Studying Java ―― 9
Java scratch scratch
java (constructor)
[Java] ArrayDeque
java (override)
java (method)
Java Day 2018
Java string
java (array)
Java static
java beginner 4
Studying Java ―― 4
Java (set)
java shellsort
[Java] compareTo
Studying Java -5
java reflexes
Java memorandum
☾ Java / Collection
Java array
Studying Java ―― 1
[Java] Array
[Java] Polymorphism
Studying Java # 0
Java review
java framework
[Java] Inheritance
FastScanner Java
java beginner 3
[Java] Remove whitespace from character strings
java (encapsulation)
[Effective Java] Remove obsolete object references
Java inheritance
[Java] Overload
Java basics
Decompile Java
[Java] Annotation
java notes
java beginner
Java (add2)
JAVA (Map)
[java] interface
Java9 collection
Java basics
Java methods
Java inheritance
[Java] enum
[Java] FizzBuzzCounter
Studying Java ―― 8
Java array
Java method
java serializable
JAVA memorandum