Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.ConcurrentLinkedQueue; public class ConcurrentLinkedQueueForEachExample3 { static int i =0; public static void main(String[] args) { ConcurrentLinkedQueue
queue = new ConcurrentLinkedQueue
(); queue.add("reema"); queue.add("sonia"); //foreach() will perform the given action for each element for (String val : queue) { String upperCase = val.toUpperCase(); System.out.println(++i + " Lower case = " + val); System.out.println(" Upper case = " + upperCase); System.out.println(); } } }
Output