Biblioteca Java - Blame information for rev 39
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
39 | mihai | 1 | package introducere.java.arrays; |
4 | mihai | 2 | |
3 | |||
4 | class ArrayDemo { | ||
5 | public static void main(String[] args) { | ||
6 | int[] anArray; // declares an array of integers | ||
7 | |||
8 | anArray = new int[10]; // allocates memory for 10 integers | ||
9 | |||
10 | anArray[0] = 100; // initialize first element | ||
11 | anArray[1] = 200; // initialize second element | ||
12 | anArray[2] = 300; // etc. | ||
13 | anArray[3] = 400; | ||
14 | anArray[4] = 500; | ||
15 | anArray[5] = 600; | ||
16 | anArray[6] = 700; | ||
17 | anArray[7] = 800; | ||
18 | anArray[8] = 900; | ||
19 | anArray[9] = 1000; | ||
20 | |||
21 | System.out.println("Element at index 0: " + anArray[0]); | ||
22 | System.out.println("Element at index 1: " + anArray[1]); | ||
23 | System.out.println("Element at index 2: " + anArray[2]); | ||
24 | System.out.println("Element at index 3: " + anArray[3]); | ||
25 | System.out.println("Element at index 4: " + anArray[4]); | ||
26 | System.out.println("Element at index 5: " + anArray[5]); | ||
27 | System.out.println("Element at index 6: " + anArray[6]); | ||
28 | System.out.println("Element at index 7: " + anArray[7]); | ||
29 | System.out.println("Element at index 8: " + anArray[8]); | ||
30 | System.out.println("Element at index 9: " + anArray[9]); | ||
31 | } | ||
32 | } |