Write a program in java to demonstrate for-each loop?

public class ForEach

{

                public static void main(String arg[])

                {

                                String name[]={"Vikrant","IT TIME PASS","Vikash","Vivek","Lalit"};

                                System.out.println("Using For-Each Loop");

                                for(String s:name)

                                {

                                                System.out.println("\t"+s);

                                }

                }

}

For-Each Loop.PNG

, , , , , ,

Leave a Reply