bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java How To's
Java•Java How To's

Java How To Loop Through an ArrayList

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Java How To Loop Through an ArrayList?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

public ___ Main {

Loop Through an ArrayList

Loop through the elements of an ArrayList :

Example

public class Main {
  public static void main(String[] args) {
    ArrayList<String> cars = new ArrayList<String>();
    cars.add("Volvo");
    cars.add("BMW");
    cars.add("Ford");
    cars.add("Mazda");
    for (String i : cars) {
      System.out.println(i);
    }
}
}

Related Pages

Java ArrayList Methods

Previous

Java How To - Check if a Number Is Prime

Next

Java How To Loop Through a HashMap