diff --git a/Bank-Beispiel/src/uebungen/ArrayListUebung.java b/Bank-Beispiel/src/uebungen/ArrayListUebung.java new file mode 100644 index 0000000..3671061 --- /dev/null +++ b/Bank-Beispiel/src/uebungen/ArrayListUebung.java @@ -0,0 +1,36 @@ +package uebungen; + +import java.util.ArrayList; + +public class ArrayListUebung { + public static void main(String[] args) { + + String [] fruits = new String [3]; + fruits[0] = "Mango"; + fruits[1] = "Apple"; + fruits[2] = "Strawberry"; + + System.out.println(fruits[1]); + + ArrayList fruitList = new ArrayList(); + fruitList.add((double) 5); + fruitList.add("Apple"); + fruitList.add("Strawberry"); + fruitList.add("Watermelon"); + fruitList.add("Watermelon"); + System.out.println(fruitList.contains("Raspberry")); + System.out.println(fruitList); + + ArrayList freundeListe = new ArrayList<>(); + freundeListe.add("Paul"); + freundeListe.add("Philip"); + + System.out.println(freundeListe); + System.out.println(fruitList.get(2)); + System.out.println(fruitList.size()); + System.out.println(fruits.length); + fruitList.set(0,"Banana"); + System.out.println(fruitList); + } + +}