-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListaArreglos.java
More file actions
27 lines (25 loc) · 960 Bytes
/
ListaArreglos.java
File metadata and controls
27 lines (25 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package arrays;
import java.util.ArrayList;
public class ListaArreglos {
public static void main(String[] args) {
//ArrayList<Integer> numeros = new ArrayList<Integer>();
ArrayList<Integer> numeros = new ArrayList<>();
numeros.add(8);
numeros.add(427);
numeros.add(-75);
numeros.add(87);
System.out.println(numeros.toString());
System.out.println("El tamaño del array es: ");
System.out.println(numeros.size());
System.out.println("Obtener el valor de un elemento");
System.out.println(numeros.get(1));
System.out.println("Eliminar un elemento");
numeros.remove(2);
System.out.println(numeros.size());
System.out.println("Array completo");
System.out.println(numeros.toString());
System.out.println("Vaciar el array por completo");
numeros.clear();
System.out.println(numeros.size());
}
}