main
Drees 2022-10-24 21:51:55 +02:00
parent a38c60c123
commit e33cc74f3e
1 changed files with 36 additions and 0 deletions

View File

@ -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<String> 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);
}
}