Skip to content

Commit 051019e

Browse files
committed
conhecendo ArrayList
1 parent e5ebddd commit 051019e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package module3.arrayslist.generics.pt2;
2+
3+
import java.util.ArrayList;
4+
5+
public class TesteArrayList {
6+
7+
public static void main(String[] args) {
8+
9+
ArrayList lista = new ArrayList();
10+
11+
String nome = new String("emanoel");
12+
lista.add(nome);
13+
14+
String sobrenome = new String("campos");
15+
lista.add(sobrenome);
16+
17+
System.out.println(lista.size());
18+
System.out.println(lista.get(1));
19+
20+
for (int i = 0; i < lista.size(); i++) {
21+
System.out.print(lista.get(i) + " ");
22+
}
23+
24+
for (Object nomes : lista) {
25+
System.out.println(nomes);
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)