Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.LinkedBlockingDeque; class Employee{ String name; int bonus_points; public Employee(int bonus_points,String name) { this.name = name; this.bonus_points = bonus_points; } public String toString(){ return name +" got "+ bonus_points+" bonus_points."; } } public class LinkedBlockingDequeGetFirstExample3 { public static void main(String[] args) { Employee employee1 = new Employee(41,"Mansi"); Employee employee2 = new Employee(33,"Vaibhav"); Employee employee3 = new Employee(31,"Shraddha"); Employee employee4 = new Employee(27,"Vishal"); Employee employee5 = new Employee(26,"Shalu"); Employee employee6 = new Employee(19,"Abhi"); int capacity =100; LinkedBlockingDeque
deque = new LinkedBlockingDeque
(capacity); deque.add(employee1); deque.add(employee2); deque.add(employee3); deque.add(employee4); deque.add(employee5); deque.add(employee6); for (Employee xyz : deque){ System.out.println(xyz); } System.out.println(); System.out.println("On the basis of bonus points, Promotion is awarded to : "+deque.element().name); } }
Output