From e33cc74f3e0f84b21e24fc55f24277f376bf2142 Mon Sep 17 00:00:00 2001 From: Drees Date: Mon, 24 Oct 2022 21:51:55 +0200 Subject: [PATCH] =?UTF-8?q?=C3=9Cbungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/uebungen/ArrayListUebung.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Bank-Beispiel/src/uebungen/ArrayListUebung.java 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); + } + +}