The original "list 4: simple equivalent code for Traversing arrays" is incorrect and should be:
Listing 4: simple equivalent code for Traversing arrays/* Creating an array */
Int [] integers = {1, 2, 3, 4 };
/* Start traversal */
For
(INT variable name a = 0; variable name {
???? System. Out. println (Integers [variable name A]);/* Output "1", "2", "3", and "4" in sequence "*/
}
Thank you for your correction.
The original "Listing 6: equivalent code for traversing the collection in a simple way" is incorrect and should be:
Listing 6: simple equivalent code for Traversing collection/* Creating a collection */
String [] strings = {"A", "B", "C", "D "};
Collection stringlist = java. util. arrays. aslist (strings );
/* Start traversal */
For
(Iterator variable name B = List. iterator (); variable name B. hasnext ();){
????
Object STR = variable name B. Next ();
???? System. Out. println (STR);/* output "A", "B", "C", and "D" in sequence "*/
}
Thanks to Bin's correction.