Retrieving elements from collections
Following four ways are used to retrieve elements from collection object : Using for-each loop. Using Iterator Interface. Using ListIterator interface. Using Enumeration Interface. For-each loop : for-each loop is like for loop which repeatedly executes a group of statements,for each element of collection the format is for(variable:collection object) // for( String values: os) {…
