Java Program to Access Elements of Character Array Using for Each Loop

You are currently viewing Java Program to Access Elements of Character Array Using for Each Loop

Java program to access elements of character array using for each loop

// Java program to access elements of character 
// array using for each loop

public class Main {
  public static void main(String[] args) {
    char charArray[] = {'A', 'B', 'C', 'D', 'E', 'F'};

    System.out.println("Array elements: ");
    for (char ch: charArray)
      System.out.println(ch);
  }
}

Output

Array elements: 
A
B
C
D
E
F

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply