015-004-006

Basic ArrayList Operations

Easy

Problem Description

Basic ArrayList Operations

In this problem, you will create a program that adds "Apple", "Banana", and "Cherry" to an ArrayList<String> in order, iterates through all elements using an enhanced for loop, and displays the result to standard output.

Learning Objective: Understand basic operations of dynamic array ArrayList (add, get, size)

Overview

Create a program that adds elements to ArrayList and outputs all elements in a loop.

Specifications

  • Create ArrayList
  • Add "Apple", "Banana", "Cherry" in order
  • Output all elements with enhanced for loop

Output Format

Apple
Banana
Cherry

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up