for each loop

Write a show usage and syntax of for each loop.

 

import java.util.*; class P21ForEachLoop { public static void main() { P17ArrayMethods ob= new P17ArrayMethods() ; String[] b= ob.getString(); for (String a :b) System.out.println(" List of name" + a); System.out.println(" \n Printing arrays without using loop\n" +Arrays.toString(b)); } }


Note : you need to keep P17ArrayMethods class in same project folder.


For any desired program, please comment below. We will try our best to make that program available.


Comments

Popular Posts