Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.LinkedBlockingDeque; class Student{ private String f_name; private String l_name; private int roll_no; public Student(String f_name, String l_name, int roll_no) { this.f_name = f_name; this.l_name = l_name; this.roll_no = roll_no; } public String toString(){ return f_name+" " +l_name+" "+roll_no; } } public class LinkedBlockingDequeOfferExample3 { public static void main(String[] args) { Student student1 = new Student("Harshit", "Bhardwaj ", 15023022); Student student2 = new Student("Rahul","Verma ",15023045); Student student3 = new Student("Deepanjali","Thakur ", 15023015); int capacity = 100; LinkedBlockingDeque
deque = new LinkedBlockingDeque
(capacity); deque.add(student1); deque.add(student2); deque.add(student3); Student student4 = new Student("Raman", "Mehta ", 14022056); deque.offer(student4); for (Student xyz : deque) { System.out.println(xyz); } } }
Output