Online Java Compiler By
JavaTpoint.com
import java.util.ArrayDeque; import java.util.Deque; public class JavaDequepeekFirstExample3 { public static void main(String[] args) { Deque
deque = new ArrayDeque<>(); deque.offer('H'); deque.offer('E'); deque.offer('L'); deque.offer('L'); deque.offer('O'); Character val = deque.peekFirst(); System.out.println("The first characater value is given as : "+val); System.out.println("The final deque is given as : "); for (Character character : deque) { System.out.println(character); } } }
Output