Arrays Aufgabe 1

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/4

flashcard set

Earn XP

Description and Tags

Befüllen Sie ein Array der Größe einer beliebigen Zufallszahl vollständig mit eben dieser (mit Hilfe einer Schleife)

5 Terms

1
New cards

// Erstelle ein int-Array mit 5 Plätzen.

int[] zahlen = new int[5];

2
New cards

// Erstelle ein Array, dessen Größe in zahl steht.

int zahl = 4;

int[] zahlen = new int[zahl];

3
New cards

// Erzeuge eine Zufallszahl von 1 bis 10.

int zahl = (int) (Math.random() * 10) + 1;

4
New cards

// Schreibe eine for-Schleife, die alle Plätze

// des Arrays zahlen durchläuft.

for (int i = 0; i < zahlen.length; i++) {

}

5
New cards

// Schreibe zahl an die aktuelle Position i

// im Array zahlen.

zahlen[i] = zahl;