-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayExample.java
More file actions
31 lines (23 loc) · 885 Bytes
/
ArrayExample.java
File metadata and controls
31 lines (23 loc) · 885 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
28
29
30
31
import java.util.ArrayList;
public class ArrayArrayListExample {
public static void main(String[] args) {
// ArrayList Example
ArrayList<String> arrlistobj = new ArrayList<String>();
arrlistobj.add("Ich bin toll");
arrlistobj.add("Liebe");
System.out.println("ArrayList Ausgabe :");
for(int index = 0; index < arrlistobj.size(); index++) {
System.out.println(arrlistobj.get(index));
}
System.out.println();
// Array Example
String[] arrayobj = new String[3];
arrayobj[0]= "Liebe";
arrayobj[1]= "Ich bin toll";
arrayobj[2]= "Du auch!";
System.out.println("Array Ausgabe :");
for(int index=0; index < arrayobj.length ;index++) {
System.out.println(arrayobj[index] + " ");
}
}
}