JAVA · ОСНОВЫ · LESSON 23
The list that grows
ArrayList · about 16 minutes
Learning with progressRead the summary for free. To save the work, log in to the account.
Type the code yourself
Type an example manually. Check the signs and brackets.
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
ArrayList<String> pets = new ArrayList<>();
pets.add("кот");
pets.add("пёс");
System.out.println(pets.size());
}
}Open the editor for class workSolve it yourself
Подключи ArrayList. Создай ArrayList<String> colors, добавь «красный», «синий», «зелёный» и выведи размер списка через size().
The answer is hidden. Use similar examples from the lesson notes.
Opening up your homework