Package namespace; import Java. util. *; public class arraystest {public static void main (string ARGs []) {arrayfor (); listfor (); mapfor ();} public static void arrayfor () // For traversing the Array {int array [] = {1, 2, 3, 4}; For (int I: array) {system. out. println (I) ;}} public static void listfor () // For traversing list {list <string> List = new arraylist <string> (); list. add ("AAA"); list. add ("BBB"); list. add ("CCC"); list. add ("DDD"); For (string STR: List) system. out. println (STR);} public static void mapfor () {hashmap <integer, string> hashmap = new hashmap <integer, string> (); hashmap. put (1, "AAA"); hashmap. put (2, "BBB"); hashmap. put (3, "CCC"); hashmap. put (4, "DDD"); For (map. entry <integer, string> entrykey: hashmap. entryset () {system. out. println (entrykey. getkey () + "... "+ entrykey. getvalue ();} // use iterator for (iterator <map. entry <integer, string> it = hashmap. entryset (). iterator (); it. hasnext ();) system. out. println (it. next ();}/** for advanced loop applications ** 9:46:58 **/