public class ForEachLoop {
public static void main(String[] args) {
int arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
char arr1[] = { 'a', 'b', 'c', 'd', 'e' };
String arr2[] = { "ramkesh", "vijay", "sudeep", "Narveen", "kuldeep" };
System.out.println(
"---------------------------------------------------------"
);
//ForEachLoop to print int array
for (int i : arr) {
System.out.print(i + ",");
}
System.out.println(
"---------------------------------------------------------"
);
//ForEachLoop to print char array
for (char c : arr1) {
System.out.print(c + ",");
}
System.out.println(
"---------------------------------------------------------"
);
//ForEachLoop to print String array
for (String s : arr2) {
System.out.print(s + ",");
}
System.out.println();
}
}