generated from hummel/Bank-System
Übungen
parent
a38c60c123
commit
e33cc74f3e
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue