Skip to content

Commit 8736edd

Browse files
committed
array de primitivos
1 parent 0cd96eb commit 8736edd

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package module1.arrays;
2+
3+
public class ArrayPrimitivos {
4+
5+
public static void main(String[] args) {
6+
7+
int[] numeros; //também pode ser dessa forma: int numeros[];
8+
String[] nomes = new String[3]; //precisa ser inicializado com um valor
9+
10+
nomes[0] = "emanoel";
11+
nomes[1] = "campos";
12+
nomes[2] = "viana";
13+
14+
String meuNome = nomes[0];
15+
16+
System.out.println(meuNome);
17+
System.out.println(nomes.length);
18+
19+
for(int i = 0; i < nomes.length; i++) {
20+
System.out.print(nomes[i] + " ");
21+
}
22+
23+
}
24+
}

0 commit comments

Comments
 (0)